| | |
oledbDataAdapter.update exception: No value given for one or more required parameter
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Nov 2008
Posts: 2
Reputation:
Solved Threads: 0
oledbDataAdapter.update exception: No value given for one or more required parameter
0
#1 Nov 22nd, 2008
Hi I'm getting the following exception from accessDa.Update(ds.Tables(0))
No value given for one or more required parameters
In the following code (marked in red).
I've looped thru the ds dataset and all the columns have notNull values
I've checked the field names and number of columns are ok
Any Help appriciated
Thanks
No value given for one or more required parameters
In the following code (marked in red).
Protected Sub DataTableCurrMonthForWorker(ByVal ccMifal, ByVal ccWorkerID, ByVal theYear, ByVal theMonth)
Dim totInsert As Integer
Dim currDay As Integer = 1
Dim theDate As Date
Dim ds As New DataSet("dsClockCard")
Dim dt As New DataTable("ClockCard")
Dim dc As DataColumn
Dim dr As DataRow
ds.Tables.Add(dt)
dc = New DataColumn("Mifal", GetType(Integer), ccMifal)
dt.Columns.Add(dc)
dc = New DataColumn("WorkerID", GetType(Integer), ccWorkerID)
dt.Columns.Add(dc)
dc = New DataColumn("ccYear", GetType(Integer), theYear)
dt.Columns.Add(dc)
dc = New DataColumn("ccMonth", GetType(Integer), theMonth)
dt.Columns.Add(dc)
dc = New DataColumn("ccDay", GetType(Integer))
dt.Columns.Add(dc)
dc = New DataColumn("ccSubDay", GetType(Integer), 1)
dt.Columns.Add(dc)
dc = New DataColumn("ccDate", GetType(Date))
dt.Columns.Add(dc)
If IsDate(theMonth & "/" & 20 & "/" & theYear) Then
While IsDate(theMonth & "/" & currDay & "/" & theYear)
theDate = theMonth & "/" & currDay & "/" & theYear
dr = dt.NewRow
dr.BeginEdit()
dr(4) = currDay
dr(6) = theDate
dt.Rows.Add(dr)
dr.EndEdit()
currDay = currDay + 1
End While
Else
While IsDate(currDay & "/" & theMonth & "/" & theYear)
theDate = theMonth & "/" & currDay & "/" & theYear
dr = dt.NewRow
dr.BeginEdit()
dr(4) = currDay
dr(6) = theDate
dt.Rows.Add(dr)
dr.EndEdit()
currDay = currDay + 1
End While
End If
DALayer.fnUpdateDataBaseFromDataSet(ds)
End Sub
Dim accessConn As New OleDbConnection
Dim accessDa As OleDbDataAdapter
Dim accessCmd As OleDbCommand
Public Function fnUpdateDataBaseFromDataSet(ByVal ds As DataSet)
Try
If accessConn.State = ConnectionState.Open Then
accessDa = New OleDbDataAdapter(accessCmd)
accessCmd = New OleDbCommand("INSERT INTO ClockCard ([Mifal], " & _
[WorkerID], [ccYear], " & _
"[ccMonth], [ccDay], " & _
"[ccSubDay], [ccDate]) " & _
"VALUES (@Mifal, @WorkerID, @ccYear, @ccMonth, " & _
"@ccDay, @ccSubDay, @ccDate)", accessConn)
accessDa.InsertCommand = accessCmd
accessDa.Update(ds.Tables(0)) accessConn.Close()
accessDa.Dispose()
Return True
end if
Catch ex As Exception
Current.Response.Write("exception from fnUpdateDataBaseFromDataSet: " & ex.Message & "<br>")
Finally
If accessConn.State = ConnectionState.Open Then
accessConn.Close()
accessDa.Dispose()
End If
End TryI've looped thru the ds dataset and all the columns have notNull values
I've checked the field names and number of columns are ok
Any Help appriciated
Thanks
•
•
Join Date: Sep 2007
Posts: 66
Reputation:
Solved Threads: 12
Re: oledbDataAdapter.update exception: No value given for one or more required parameter
0
#2 Nov 22nd, 2008
Pls. check your Paramater values may have extra ", " (comma ). when SQL encounter any comma, it considers a new param. pls . try and let me know.
ASP.NET Syntax (Toggle Plain Text)
INSERT INTO ClockCard ([Mifal], " & _ [WorkerID], [ccYear], " & _ "[ccMonth], [ccDay], " & _ "[ccSubDay], [ccDate]) " & _ "VALUES (@Mifal, @WorkerID, @ccYear, @ccMonth, "@ccDay, @ccSubDay, @ccDate)", accessConn)
•
•
Join Date: Nov 2008
Posts: 2
Reputation:
Solved Threads: 0
Re: oledbDataAdapter.update exception: No value given for one or more required parameter
0
#3 Nov 22nd, 2008
![]() |
Other Threads in the ASP.NET Forum
- Previous Thread: Storing an Encrypted file in database
- Next Thread: search record from database
| Thread Tools | Search this Thread |
.net 2.0 3.5 activexcontrol advice ajax appliances asp asp.net bc30451 beginner bottomasp.net box browser businesslogiclayer button c# c#gridviewcolumn cac checkbox class click compatible confirmationcodegeneration content contenttype control countryselector courier css database datagrid datagridview datagridviewcheckbox datalist deadlock deployment development dgv dialog dropdownmenu dynamic edit embeddingactivexcontrol fileuploader findcontrol flash flv forms gridview gudi homeedition iframe iis javascript jquery list menu mono mssql multistepregistration nameisnotdeclared novell objects order problem ratings redirect registration relationaldatabases rotatepage save search security serializesmo.table sessionvariables silverlight smartcard sql ssl suse textbox tracking treeview unauthorized validatedate validation vb.net video virtualdirectory vista visual-studio visualstudio vs2008 web webarchitecture webdevelopemnt webdevelopment wizard xml





