well i have it all going so far, except for one error...i am kinda new to this style i actually hardcoded the link to the database instead of using data adapter wizard....so that is probably my biggest problem...the syntax is different
Here is the Error i am getting
"ERROR UPDATING THE DATABASE! UPDATE REQUIRES A VALID INSERTCOMMAND WHEN PASSED DATAROW COLLECTION WITH NEW ROWS"
so basically here is the snippet of code just to take a look at this is the function save to database
well i have it all going so far, except for one error...i am kinda new to this style i actually hardcoded the link to the database instead of using data adapter wizard....so that is probably my biggest problem...the syntax is different
Here is the Error i am getting
"ERROR UPDATING THE DATABASE! UPDATE REQUIRES A VALID INSERTCOMMAND WHEN PASSED DATAROW COLLECTION WITH NEW ROWS"
so basically here is the snippet of code just to take a look at this is the function save to database
Public Sub SaveToDataBase()
Dim TheRecord As DataRow
Dim FoundRows() As DataRow
FoundRows = dsHelpDesk.Tables("Calls").Select("CallID='" & txtCallID.Text & "'")
If FoundRows.Length = 0 Then
TheRecord = dsHelpDesk.Tables("Calls").NewRow()
TheRecord("CallID") = txtCallID.Text
TheRecord("CallerID") = txtCallerID.Text
TheRecord("Priority") = PriorityLevel
TheRecord("ProblemID") = Problem
TheRecord("DateCalled") = dtpCallDateTime.Text
TheRecord("Resolved") = Resolved
dsHelpDesk.Tables("Calls").Rows.Add(TheRecord)
End If
CallsDataAdapter.InsertCommand = New OleDbCommand("insert into Calls values(txtCallID.text,txtCallerID.Text,PriorityLevel,Problem,dtpCallDateTime.Text,Resolved)", objConn)
CallsDataAdapter.Update(dsHelpDesk, "Calls")
dsHelpDesk.AcceptChanges()
Try
MessageBox.Show("Changes saved to database")
Catch eSystem As Exception
MessageBox.Show("Error updating the database! " & eSystem.Message)
End Try
Call ClearControls()
End Sub
THE PART I HAVE BOLDED I AM NOT SURE ABOUT...SO IF SOMEONE COULD PLEAE GIVE A LITTLE ADVICE I WOULD BE FOREVER IN DEBT
thanks
leeland
Here is the Error i am getting
"ERROR UPDATING THE DATABASE! UPDATE REQUIRES A VALID INSERTCOMMAND WHEN PASSED DATAROW COLLECTION WITH NEW ROWS"
so basically here is the snippet of code just to take a look at this is the function save to database
well i have it all going so far, except for one error...i am kinda new to this style i actually hardcoded the link to the database instead of using data adapter wizard....so that is probably my biggest problem...the syntax is different
Here is the Error i am getting
"ERROR UPDATING THE DATABASE! UPDATE REQUIRES A VALID INSERTCOMMAND WHEN PASSED DATAROW COLLECTION WITH NEW ROWS"
so basically here is the snippet of code just to take a look at this is the function save to database
Public Sub SaveToDataBase()
Dim TheRecord As DataRow
Dim FoundRows() As DataRow
FoundRows = dsHelpDesk.Tables("Calls").Select("CallID='" & txtCallID.Text & "'")
If FoundRows.Length = 0 Then
TheRecord = dsHelpDesk.Tables("Calls").NewRow()
TheRecord("CallID") = txtCallID.Text
TheRecord("CallerID") = txtCallerID.Text
TheRecord("Priority") = PriorityLevel
TheRecord("ProblemID") = Problem
TheRecord("DateCalled") = dtpCallDateTime.Text
TheRecord("Resolved") = Resolved
dsHelpDesk.Tables("Calls").Rows.Add(TheRecord)
End If
CallsDataAdapter.InsertCommand = New OleDbCommand("insert into Calls values(txtCallID.text,txtCallerID.Text,PriorityLevel,Problem,dtpCallDateTime.Text,Resolved)", objConn)
CallsDataAdapter.Update(dsHelpDesk, "Calls")
dsHelpDesk.AcceptChanges()
Try
MessageBox.Show("Changes saved to database")
Catch eSystem As Exception
MessageBox.Show("Error updating the database! " & eSystem.Message)
End Try
Call ClearControls()
End Sub
THE PART I HAVE BOLDED I AM NOT SURE ABOUT...SO IF SOMEONE COULD PLEAE GIVE A LITTLE ADVICE I WOULD BE FOREVER IN DEBT
thanks
leeland