Hi everybody,
i am writing an application that connects to a database and i am stuck at the point where i made my changes in my dataset and i want to write back from my dataset to my db. I tried it and my data are can be altered in the dataset but never on the database...
do i update line by line to my database?
do i update with a command the whole dataset?
below is a sample of my code
any ideas or recommendations please tell me
Code:---by clicking the button update the follow commands should run 'check first if the dataset is loaded If (cmydataset.Tables.Contains("course")) Then cmyadapter = New OleDb.OleDbDataAdapter("select * from student", cmycon) 'normally here i would have more than one field but i omitted for simplicity reasons cmyadapter.UpdateCommand = New OleDb.OleDbCommand("Update course set cour_name = Textbox1.text " & _ " WHERE Cour_ID = Textbox2.text") 'check if there are null values If (TextBox1.Text = "") Then MsgBox("you have nulls, you cannot enter null values") Else 'chekc update student constraints 'if ok 'update student data cmyadapter.Update(cmydataset, "Course") cmydataset.AcceptChanges() End If End If


LinkBack URL
About LinkBacks




Reply With Quote


Bookmarks