No value given for one or more required parameters

Joined
Sep 19, 2005
Messages
1
Reaction score
0
Hi, I just started with Asp.Net. Im trying to make an .aspx pagewith populated Dropdownlist, which will - after clicking a button - send selected value to the next page. I use this Command.

Sub submit(sender As Object, e As EventArgs)

Server.Transfer("Katalog.aspx", True)
End Sub


But when I try to submit some value, I get the error message "No value given for one or more required parameters". Im tryin to use this value in Select query to filter a table. Debug shows error on line dataAdapter.Fill(dataSet). Name of submitted variable is autor.

Whole code is here...

Sub BindGrid()

Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=D:\Skola\Vlastne\Knihkupectvo.mdb"
Dim CommandText As String

CommandText = "SELECT meno_autora, nazov_titulu, zaner, cena from Katalóg WHERE 1=1"


If Request.Form("autor") <> String.Empty Then
CommandText = CommandText & " AND [Meno autora] = """ & Request.Form("autor") & """"
End If

Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString)


Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand
dbCommand.CommandText = CommandText
dbCommand.Connection = dbConnection

Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim dataSet As System.Data.DataSet = New System.Data.DataSet
dataAdapter.Fill(dataSet)


DataGrid1.DataSource = dataSet
DataGrid1.DataBind()

End Sub


Thanx for help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top