• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1940
  • Last Modified:

vb.net command builder

I know that vb.net command builder is created automatically through dataAdapter, I would like to know in which circumstance I should create a command builder through the code.

an example might help.

thanks

0
jskfan
Asked:
jskfan
  • 2
2 Solutions
 
dttriCommented:
Greetings!
This article contains an example on how to use SQLCommandBuilder class:
http://www.developer.com/lang/other/article.php/963511
0
 
Davidshc76Commented:
OleDbCommandBuilder can be use to generate the command for insert, update, delete ....
But your table must have primary key generated. Below are the sample code ........

DaUserList = New OleDbDataAdapter()
DaUserList.SelectCommand = New OleDbCommand(SelectString, g_objconn)

Dim CB As OleDbCommandBuilder
CB = New OleDbCommandBuilder(DaUserList)
DaUserList.InsertCommand = CB.GetInsertCommand()
DaUserList.UpdateCommand = CB.GetUpdateCommand()
DaUserList.DeleteCommand = CB.GetDeleteCommand()

DsUserList = New DataSet()
DaUserList.Fill(DsUserList, "USERMASTER")
0
 
dttriCommented:
There are many different CommandBuilder versions for different database system, eg OleDBCommandBuilder, SQLCommandBuilder, OracleCommandBuilder... but the general syntax is the same.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now