Visual Basic 6 and MS Access 2000

Status
Not open for further replies.

sohummisra

Broken In
Here is the problem. I am making a program (a game actually) where I want to use a Microsoft Access 2000 database (using MS Access XP) to hold the data for the program, which I am coding in Visual Basic 6. I have never used third-party databases in VB programming before this and thus still have to learn a lot in that regard. When I try to use the database using the Data control it says that the database format is not acceptable. This is because the DB is essentially too new. :D

Can anyone direct me as to how exactly I can incorporate this database into my program without resorting to the home-grown database methods? When searching for solutions on the net all I can find our expertsexchange questions (but not the solutions, of course). I have Visual Studio .NET 2003 too, if that is any help (as in I should develop it in that environment). Also, does anyone have any nice online resources I can use (newbie, probably) to help with database programming in VB6. Thanks.
 

it_waaznt_me

Coming back to life ..
All you need is ADO .. Just put an ADO control on your form, build the database connection string and you can access the database from your program ..

Lemme search some ADO tutorial for you ...

Okay .. here they are :
DevGuru's ADO tutorial
DevArticle's Implementation article
Sample Sourcecode from PSC ...
 
OP
S

sohummisra

Broken In
Thanks for the reply. Yeah I figured out that the ADO control works by looking through the SAMS book...well actually reading it (the last time I was just looking for a quick fix). Now it all works perfectly fine, although I still have to work on the syntax a bit. Thanks again.
 

technoteen

Journeyman
i will recommend you not to use the ado control directly,

instead use the microsoft active x data library(select it from refrences) and then create a connection string in a module in your project

as you are using vb i hope you are completely aquinted with it

an example of connection string in module

Public Con As New ADODB.Connection
Public Rs As New ADODB.Recordset

Public Sub Connect()

Con.Provider = "Microsoft.Jet.Oledb.3.51"
Con.ConnectionString = "Data Source = " & App.Path & "\Database.mdb"
Con.Open

End Sub

then you can call this connect procedure anywhere in your program(you will need to use it just once) then use the recordset to fill it by using SQL qeuries

hope this will help you, for more you can mail me
 

it_waaznt_me

Coming back to life ..
To use Access 2000 database he will need Jet 4.0 driver ..

I didnt gave him this suggestion cauz it will be tough for him .. Let him become comfortable with the Control first .. Then he can use the Code way too...
 

technoteen

Journeyman
oh sorry about it
i didnt notice that mistake

i just suggested this method because it more faster and powerfull but lets wait for his response what he says
 

it_waaznt_me

Coming back to life ..
Ah.. dont say sorry yaar .. Yes its true its much faster than the control itself and more powerfull .. I too use when I have to run multiple queries ..
 
OP
S

sohummisra

Broken In
Yeah my book doesn't have all the syntax and code for the coding method, but I am picking it up as I go. I guess the Data Control didn't work because it didn't use Jet 4??
 
Status
Not open for further replies.
Top Bottom