update record from vb.net2003 to Ms access 2003

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2008
Posts: 2
Reputation: onilu is an unknown quantity at this point 
Solved Threads: 0
onilu onilu is offline Offline
Newbie Poster

update record from vb.net2003 to Ms access 2003

 
0
  #1
Oct 27th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 45
Reputation: cellus205 is an unknown quantity at this point 
Solved Threads: 1
cellus205 cellus205 is offline Offline
Light Poster

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

 
0
  #2
Oct 27th, 2008
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC