Why don't you just use the built-in data control? I'm a bit rusty, but doesn't that allow you to connect to an access database and use SQL?
Printable View
Why don't you just use the built-in data control? I'm a bit rusty, but doesn't that allow you to connect to an access database and use SQL?
maybe a working project will help you out At least i think this is the working project. the install is good but thats 14MB. yup thats vb
Ok, I just got a lot better at databases after using them :) If you would like some RTH(real time help) IM me,
AIM: Wix 555 Lesser Evil
MSN(not paying so not sure if it still works): [email protected]
I hope I can help, I also found a neat article on protecting your databases.
http://www.advisor.com/doc/11530
Thiswill not work because there is a space between "support. microsoft", the link should be http://support.microsoft.com/default...ent/secfaq.aspQuote:
-Sam-
I having the same problem too.
you can connect to a database using ADO here is a sample code if you are connection to the SQL server 7 database
dim con as adodb.connection
dim rs,rs_c,rs_f as adodb.recordset
Set con = New ADODB.connection
con.Open ("Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=CivilSupplies") //civilSupplies is the name of the database
Set rs = New ADODB.Recordset /*ration_card_mast,citizen_mast,family_detail mast are the three tables in the database civilsupplies*/
rs.Open ("Ration_card_mast"), con, 1, 2
Set rs_C_Mast = New ADODB.Recordset
rs_C_Mast.Open ("Citizen_Master"), con, 1, 2
Set rs_F_Detail = New ADODB.Recordset
rs_F_Detail.Open ("Family_Details"), con, 1, 2
this is a sample code from one of my projects if you want more comprehencive sample or any other help regarding vb or any other topic you can e-mail me at [email protected]
i am attaching u a project i made when i was learning vb6 it a supermarket automation system it is a complete project u can use it as a reference
Most of the code posted looks good. But everyone who posted code forgot 1 important detail. In order for: "dim db as new ADODB.Connection" to istantiate the ADODB connection object a reference must be included in the project.
Project >> References >> Microsoft ActiveX Data Objects 2.5 library
'Begin Code
dim cn as new ADODB.Connection
cn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"dbq=C:\vb\inventory\inventory.mdb"
'End code
Also if you would like to test the connection state of the object (always a good idea you can toss in some generic conditionals such as:
if(cn.state=1) then isCon=true
Hope this helps.
sbg
Hello, i just turned in my VB + Access project yesterday. To connect to a DB there are two modes ADO and DAO. I used DAO, which is done by just adding the Data object to your project, this object has a property called databasename, choose the path in which you DB is stored. Next there is a property called Recordsource, here you choose the table on your DB to which you want to connect.
To execute SQL: (your data object is data1) data1.recordsource="select * from......
or data1.execute="delete * from.....
To connect using ADO, I have done it in Asp, if you want I will post details about it.
I am attaching a small example, just choose the BIBLIO database that comes as a sample in your VB folder and it should work.
If you want my full project or any further help, just say so.
J
Visual Basic 6.0 wont connect to access 2000 unless some sort of patch or upgrade is applied, check MS knowledge base for details
How do I find the data in DB, lets say before I want to add new the data into DB, I need to check the records(Primary key) in DB wheter there is similar value. And how to put it in array?