Updatation Error!!!

sohaib

Well-known member
Joined
Apr 30, 2005
Messages
64
Programming Experience
3-5
Hi Guys!!!

I have attached a .jpg file in which error is displayed...

Actually, I made an edit button and in which edit click event i used

System.data.datarow

My other code lines are as under:-
dim intvalue as integer


intValue = MessageBox.Show("Do you want to save changes?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Information)
If (intValue = DialogResult.Yes) Then

Me.BindingContext(FollowUpData, "FollowUpsComments").EndCurrentEdit()

FollowUpAdapter.Update(FollowUpData)MsgBox("The record has been Updated", MsgBoxStyle.Information)
Me.BindingContext(FollowUpData, "FollowUpsComments").Position = Me.BindingContext(FollowUpData, "FollowUpsComments").Position

RecordLbl.Text = (((
Me.BindingContext(FollowUpData, "FollowUpsComments").Position + 1).ToString + " Of ") & _
Me.BindingContext(FollowUpData, "FollowUpsComments").Count.ToString)

But now error is displayed with the message which i have attached with it...

so plz guide me in this regard how i can update/edit the previous records!!!!

Ok Bye
 

Attachments

  • UpdateError.JPG
    UpdateError.JPG
    16.5 KB · Views: 67
You are calling Update on a DataAdapter and passing it a DataSet or DataTable that has updated rows. In order to perform the update, the DataAdapter must have a valid Command object assigned to its UpdateCommand property. The command must have CommandText that is a valid SQL UPDATE statement, amongst other things. Likewise, if you want to insert rows and delete rows you need an InsertCommand and a DeleteCommand.

I suggest you ccheck the help topics available for the type of DataAdapter you are using. Also download the 101 samples from Microsoft, which include data access samples. Kulrom has posted their location in this thread.
 
Thanx for remembering me those codes!!

I have already downloaded it..anyways i m talking about datarow functionality...

I know Kulrom have done by using SQL Command...

But once i have read in one of the tutorial or somewhere in the net about the datarow...which i understood as an easy method so i used it......

Adding New row and deleting is not a problem but when i m trying to update it....i will have an error so if you help me in this regard so i will thankful to you ...otherwise i have to change edit button scenario according to the SQL Command at last...

Help if you can!!

Ok Bye
 
Back
Top