hi every one
i'm writing a program in vb.net in visualstudio i want to know how can i update my database by using dataadapter dataset dataconnection and command builder can you give me an example thank you

Recommended Answers

All 4 Replies

Which database are you using? What is the table you want to update? Be specific.

hi
i'm going to make relation between my program a windows application and an access database i have a form with two text boxes buttons for update, new record and delete of records in my database

You could specify and update command for your Dataset like this Updating Database with a DataAdapter OR something like this:

dim cmd as new OLEDBCommand

With cmd
.connection = myconnection
.CommandType = CommandType.Text
.Text = "MyUpdate Query"
end With
cmd.ExecuteNonQuery 

hello
try something like this.

dim con as new sqlconnection("connection string")
dim cmd as new sqlcommand
con.open()
cmd.connection = con 
cmd.commandtext = "update table1 set col1=@col1,col2=@col2,col3=@col3,col4=@col4 where recid = @recid"
cmd.paramerter.addwithvalues("@col1",txt1.text)
cmd.paramerter.addwithvalues("@col2",txt2.text)
cmd.paramerter.addwithvalues("@col3",txt3.text)
cmd.paramerter.addwithvalues("@col4",txt4.text)
cmd.paramerter.addwithvalues("@recid",txtRecId.text)
cmd.ExecutenonQuery()
con.close()

hope this will help you .

Regards

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.