database connection & search

Franglais

Member
Joined
Aug 26, 2004
Messages
6
Location
South of France
Programming Experience
Beginner
I have a database and have pretty well completed the VB.net interface. I also have the data showing in textboxes and a datagrid. I am having trouble with a couple of major bits though.

Firstly, I have read somewhere that connecting to the database is better with code than the wizzards. I use oleadaptor. I am sure I have seen code for this somewhere (not in any of the books I have as they all deal with sqladaptor).

Secondly, create a query from a textbox entry and show the found records in a data grid. I cannot find any help from the books I have for this either. Is it something to do with the like or where keyword? I am lost.

Any pointers will be much appretiated.
 
Franglais said:
Firstly, I have read somewhere that connecting to the database is better with code than the wizzards.
The DataForm wizard will generate code. This is a good way to understand how to use ADO.NET as the generated code is well commented. Some believe that the code is too complex and for some cases that would be correct.

As far as the sqlAdaptor, the System.Data.OleDb nameSpace is interchangable with the System.Data.SqlClient nameSpace. They each have similar classes (the System.Data.SqlClient.SqlDataAdapter is interchangable with the System.Data.OleDb.OleDbDataAdapter). If you have code showing examples for the SqlClient nameSpace, you should be able to swap out the similar classes/methods in the OleDb nameSpace.

Have a look through the Data Access section here in this forum for many examples of creating dataBase queries. Good luck and good programming.
 
Back
Top