Question how to insert/update/delete with where clause? Plz help!

arpit08

New member
Joined
Aug 21, 2011
Messages
4
Programming Experience
1-3
hi,
I am using this piece of code

Private m_adoconn As New OleDb.OleDbConnection
Private m_daDataAdapter As OleDb.OleDbDataAdapter
Private m_cbCommandBuilder As OleDb.OleDbCommandBuilder
Private m_dttable1 As New DataTable

' procedure to for select query
m_daDataAdapter = New OleDb.OleDbDataAdapter _
("Select * From " + a, m_adoconn)
m_cbCommandBuilder = New OleDb.OleDbCommandBuilder(m_daDataAdapter)
m_daDataAdapter.Fill(m_dttable1)


Now what i need help for is how do I code for insert,update and delete queries with where clause.?
Please help!
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,496
Location
Sydney, Australia
Programming Experience
10+
First up, you don't insert with a WHERE clause. A WHERE clause is to to determine which existing records to act on, so it is only relevant to SELECT, UPDATE and DELETE statements.

As for the question in general, do you actually know why you're using an OleDbCommandBuilder? Being a beginner is MORE reason the read the documentation, not less. The first thing you should be be doing is reading the documentation for the four classes you're using in that code. Apart from anything else, doing so will answer your question.
 
Top Bottom