| | |
oledbDataAdapter.update exception: No value given for one or more required parameter
Please support our ASP.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
•
•
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 alltypeofvideos asp asp.net bc30451 bottomasp.net browser businesslogiclayer c# c#gridviewcolumn checkbox class commonfunctions compatible confirmationcodegeneration content contenttype countryselector courier css dataaccesslayer database datagrid datagridview datagridviewcheckbox datalist development dgv dropdownlist dropdownmenu dynamic dynamically edit fileuploader fill findcontrol flash flv formatdecimal forms formview gridview gudi homeedition iframe iis javascript jquery listbox menu microsoft mouse mssql multistepregistration nameisnotdeclared news objects opera panelmasterpagebuttoncontrols problem redirect registration relationaldatabases reportemail rotatepage schoolproject security serializesmo.table silverlight smartcard smoobjects software sql sql-server sqlserver2005 ssl textbox tracking unauthorized validation vb.net video videos virtualdirectory vista visual-studio visualstudio web webapplications webarchitecture webdevelopemnt webdevelopment webprogramming webservice youareanotmemberofthedebuggerusers





