943,576 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 849
  • VB.NET RSS
Oct 27th, 2008
0

update record from vb.net2003 to Ms access 2003

Expand Post »
Can anyone help my code for updating is given an error that “no value given for one or more required parameter".
my code is below

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a As Integer
a = period.Text
If period.Text >= 0 Then
period.Text = period.Text - 1

OleDbConnection1.Open()

OleDbDataAdapter1.UpdateCommand.Connection = OleDbConnection1
OleDbDataAdapter1.UpdateCommand.CommandText = "Update ok set nastaff = '" & nastaff.Text & "' , period = '" & period.Text & _
"', amount = '" & amount.Text & "', groupid = " & txtid.SelectionLength + 1 & " where Period = '" & TmpNumber & "'"

'GroupCmbo.Hide()

Try
OleDbDataAdapter1.UpdateCommand.ExecuteNonQuery()
DataSet11.Clear()
OleDbDataAdapter1.Fill(DataSet11, "ok")
Catch Ex As Exception
MsgBox(Ex.Message)
End Try
OleDbConnection1.Close()

nastaff.ReadOnly = True
amount.ReadOnly = True
loan.ReadOnly = True
period.ReadOnly = True


'UpdateBtn.Enabled = False
'UpdateBtn.Enabled = True
TmpNumber = period.Text
nastaff.Focus()

Else
TextBox1.Text = 1


End If


End Sub
Reputation Points: 10
Solved Threads: 0
Newbie Poster
onilu is offline Offline
2 posts
since Jul 2008
Oct 27th, 2008
0

Re: update record from vb.net2003 to Ms access 2003

Is your key an autonumber field? If so, just go to the tableadapter , select the update command that you are using, and under parameters, remove the parameter for the key, so that it isnt expecting that parameter to be passed
Reputation Points: 10
Solved Threads: 3
Junior Poster in Training
cellus205 is offline Offline
57 posts
since May 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: problem in inserting records
Next Thread in VB.NET Forum Timeline: Add New Item





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC