Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: Biju Thomas
  Where is Biju Thomas?
 Kochi
 India
 Biju Thomas
 To: joe Degorio
  Where is joe Degorio?
 Tacloban City
 Philippines
 joe Degorio
 Tags
Subject: RE: Get data from Access Table in foxpro
Thread ID: 203305 Message ID: 203770 # Views: 30 # Ratings: 0
Version: Visual FoxPro 9 Category: Databases, Tables and SQL Server
Date: Saturday, November 15, 2008 3:30:15 PM         
   


> >
> > Dear Joe
> > Simply create a system DSN – Microsoft Access driver (mbd)and the data source name as “mydatabase”. No need to connect it to any database at all.
> > Create a form
> > In the Init enter
> > Public mydatasource
> >
> > create a command button name it as connect. In the click event
> > If mydatasource <= 0
> > cDsnName = "mydatabase"
> > cPwd = 'mypassword'
> > cDb= "mydatabase.mdb" && with full path
> > If !File(cDb)
> > Error Message here
> > Return
> > Endif
> > aAnnStr = "DSN=" + cDsnName + ";DBQ=" + cDb + ";DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;PWD=" + cPwd + ";UID=admin;"
> > Store Sqlstringconnect(aAnnStr) To mydatasource
> > If mydatasource <= 0
> > Messagebox('No connection',0,'')
> > Endif
> >
> > Endif
> > In the Right Click Event (To disconnect)
> > If mydatasource > 0
> > aAnn =SQLDisconnect(mydatasource)
> > Store -1 To mydatasource
> > Endif
> > Save and run click on the command button
> > Open your data form go to dataenvironment window.
> > Now from the dataenvironment select Add cursoradaptor, right click on the cursor adaptor select builder. In the very 1st page select Data Source Type :ODBC. Then select Use exsisiting connection handle, enter mydatasource in Capital letter. Then go to page 2 Data Access. Select Build. Your tables from the database will be there. Enjoy the rest.
> > You can store the connection and disconnection procedures in a class and use it when you call your data form.
> > Do not forget to disconnect from the data source after your work is completed.
> > Now think about the possibilities of variable 'cDb'. You can store the data path or path to the your database in a field and retrive it. This means you can place your databases to any location you wish. Simply update the new location through a program if it is changed by the user, means the database is shifted to a new location.
> > With Regards,
> > Biju Thomas
>
> Hello Biju,
> Thanks for sharing your ideas, I appreciate it very much. Just the idea I'm looking for...
>
> regards,
> joe

I am still a kid in this programming world, just started walking, lot more to learn. That is not my own idea. The pieces were joined by lot of other friends in this community. It was a final product of team work. So, I dedicate that rating to all my friends in this community, especially to our beloved Ken.
Warm Regards,
Biju Thomas



COMPLETE THREAD
Get data from Access Table in foxpro Posted by joe Degorio @ 11/13/2008 2:36:52 AM
RE: Get data from Access Table in foxpro Posted by Glenn Villar @ 11/13/2008 3:30:45 AM
RE: Get data from Access Table in foxpro Posted by Biju Thomas @ 11/13/2008 4:38:10 AM
RE: Get data from Access Table in foxpro Posted by joe Degorio @ 11/13/2008 7:03:46 AM
RE: Get data from Access Table in foxpro Posted by Biju Thomas @ 11/15/2008 3:30:15 PM