Data input to database Best way?

desconfiado

New member
Joined
Feb 24, 2007
Messages
2
Programming Experience
10+
Hi,

I am new to VB .Net and i am having some doubts.
I am an "old" VB6 programmer and i used to build forms to input data and store the data in a database (Access or SQL) in a totaly unbound way.
Now i read in several places that in vb .Net programmers choose use the bound way, that is, bind the text box, Combo, etc directly to a data object (dataadapter i believe) connected to the database.
I would like your opinion on this and, if possible, where can i get some examples on how to accomplish this.
Thanks.
 
ADO.NET does the same job as ADO but in quite a different way. You use an SqlConnection or OleDbConnection to connect to your database, use an SqlDataAdapter or OleDbDataAdapter to execute a query and populate a DataTable, close the connection, then bind the Datatable to your control(s). When the user has made all their changes you use the same DataAdapter and Connection to execute more SQL statements to save the changes back to the database.

There are variations on this theme too, so the specifics will depend on the situation. You certainly should use data-binding though, as it makes life much simpler. There are some specific situations where it is not suitable, in which case you write your own code to transfer data to and from the UI, but the majority of the time data-binding is your best friend.

There is a ton of information and tutorials on ADO.NET available on MSDN and the Web. Just make sure that the information you're using is not specifically for VB 2005 or later.
 
Back
Top