|
-
January 29th, 2002, 09:08 PM
#1
Database
Hi ;
I m an C++/MFC Programmer and appreciate if someone could give me a small piece of code where I could connect to a Db via my ODBC Connection with some examples of doing a select query and storing the recordset results.
1-In MFC there are classed like CDatabase or CRecordSet where it makes the whole job easier.
There must be a similar thing in VB too.
2-At the start of the creating the project Do i need to select a particular template to get the development Job easire or not.?
Cheers
Share what you know and ask what you dont....
Using Java version on windows 1.8_51
-
March 1st, 2002, 06:00 AM
#2
Re: Database
2- Yes.One way (I think the standard way)is :when you use connection to Database, in your project references you must add MicroSoft Active Data Object Library x.x.... (So You use ADO components). There is other ways... another could be use DAO components.
1- When you choose how to connect to your database then you can use the proprieties of your connection type. Fo example for Ado you can use code like this:
Dim cnn as ADODB.Connection
or
Dim rs as ADODB.Recordset
ecc...
Bye
Al Sbano from Italy
beginner in vb-world
-
March 1st, 2002, 08:13 AM
#3
Re: Database
first add references to ADO from project menu and then put the following code into a form
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=True;Initial Catalog=YourCatalog;Data Source=YourServr;User ID=user;Password=pass;"
conn.Open
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open "SELECT * FROM Table", conn
let me know if this help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|