[RESOLVED] dataset fill ... parameter error????
If ever anyone needed help ...
I got following message when attempting to fill a dataset.
No value given for one or more required parameters.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException:No value given for one or more required parameters.
Source Error:
Line 207: Me.DSmdl1.Clear()
Line 208:
Line 209: Me.OleDbDataAdapter2.Fill(DSmdl1.tblCarMdl)
Line 210:
Line 211: cmbBox2.DataBind()
Source File: f:\inetpub\wwwroot\Web2\WebForm1.aspx.vb Line: 209
Stack Trace:
[OleDbException (0x80040e10): No value given for one or more required parameters.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataTable dataTable, IDbCommand command, CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
Web2.WebForm1.cmbBox_SelectedIndexChanged(Object sender, EventArgs e) in f:\inetpub\wwwroot\Web2\WebForm1.aspx.vb:209
System.Web.UI.WebControls.ListControl.OnSelectedIndexChanged(EventArgs e)
System.Web.UI.WebControls.DropDownList.System.Web.UI.IPostBackDataHandler.RaisePostDataChangedEvent( )
System.Web.UI.Page.RaiseChangedEvents()
System.Web.UI.Page.ProcessRequestMain()
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032
Re: dataset fill ... parameter error????
Sounds pretty self-explanitory. Show some code.
Re: dataset fill ... parameter error????
WILD BILL,
Thanks for speedy reply.
The procedure that contains the offensive code is as follows:
------------------------------------------------------------------------
Private Sub cmbBox_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles cmbBox.SelectedIndexChanged
Dim sqlx As String
Dim xxx As String
OleDbConnection1.Open()
xxx = cmbBox.SelectedValue
sqlx = "select field1 from table1 where table1.field2= " & xxx & " "
Me.OleDbDataAdapter2.SelectCommand.CommandText = sqlx
Me.DSmdl1.Clear()
Me.OleDbDataAdapter2.Fill(DSmdl1, "table1l")
cmbBox2.DataBind()
End Sub
I am trying to change the command text to sqlx
Thanks again.
Re: dataset fill ... parameter error????
It seems my proc did not provide try/catch and there was an error in my sql statement thereby causing an exception.
Included try/catch and corrected sql and works fine now.