I am taking parameters from my page and trying to put them into my sql query. can anyone suggest how to do this?<BR>at the min the code looks like this :<BR><BR>Sub btnRunQuery_OnClick(Sender As Object, E As EventArgs)<BR> Dim objConnection As OleDbConnection<BR> Dim objCommand As OleDbCommand<BR> Dim objDataReader As OleDbDataReader<BR> Dim strSQLQuery1 As String<BR> Dim strSQLQuery2 As String<BR> Dim strSQLQuery3 As String<BR> Dim aDataSet As New DataSet<BR> Dim oComm As OleDbDataAdapter<BR><BR> objConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("
jcowandbdvdlisting.mdb") & ";")<BR> <BR> strSQLQuery1 = "SELECT * FROM dvdlist ORDER BY dvdtitle ASC"<BR><BR> if TextBox1.SelectedItem.Text = "-- All --"<BR> strSQLQuery2 = "SELECT * FROM dvdlist ORDER BY dvdtitle ASC" <BR> else<BR> &#039;strSQLQuery2 = "SELECT * FROM dvdlist WHERE dvdtitle = @TextValue1 AND sound = @TextValue2 AND screensize = @TextValue3 AND region = @NumValue1 ORDER BY dvdtitle ASC"<BR> end if <BR>lblMsg4.Text = strSQLQuery2<BR> objConnection.Open()<BR><BR> objCommand = New OleDbCommand(strSQLQuery1, objConnection)<BR><BR> &#039; Add parameters that our SQL command takes:<BR> objCommand.Parameters.Add(New OleDbParameter("sTitle", OleDbType.VarChar, 255))<BR> <BR> objCommand.Parameters.Add(New OleDbParameter("@TextValue1", OleDbType.VarChar, 255))<BR> objCommand.Parameters.Add(New OleDbParameter("@TextValue2", OleDbType.VarChar, 255))<BR> objCommand.Parameters.Add(New OleDbParameter("@TextValue3", OleDbType.VarChar, 255))<BR> objCommand.Parameters.Add(New OleDbParameter("@NumValue1", OleDbType.Numeric, 1))<BR><BR><BR> &#039; Set the values of these parameters:<BR> objCommand.Parameters("sTitle").Value = sTitle<BR> objCommand.Parameters("@TextValue2").Value = SoundList.SelectedItem.Text<BR> objCommand.Parameters("@TextValue3").Value = ScreenSize.SelectedItem.Text<BR> objCommand.Parameters("@NumValue1").Value = Region.SelectedItem.Text<BR> <BR> objDataReader = objCommand.ExecuteReader()<BR><BR> TextBox1.DataSource = objDataReader<BR> TextBox1.DataBind()<BR> <BR> &#039;Add a new listitem to the beginning of the listitemcollection<BR> TextBox1.Items.Insert(0, new ListItem("-- Choose a DVD --"))<BR> TextBox1.Items.Insert(1, new ListItem("-- All --"))<BR><BR> objDataReader.close()<BR> objConnection.close()<BR><BR> objConnection.Open()<BR> oComm = New OleDbDataAdapter(strSQLQuery3, objConnection)<BR><BR><BR> &#039;Fill the dataset with the results of the query<BR> oComm.Fill(aDataSet, "dvdlisting")<BR><BR> <BR> datagrid1.DataSource=aDataSet.Tables("dvdlisting") .DefaultView<BR> datagrid1.DataBind()<BR><BR> &#039;Display information on what page we are currently viewing<BR> lblMsg1.Text = "Viewing Page " & datagrid1.CurrentPageIndex+1 & _<BR> " of " & datagrid1.PageCount<BR><BR> <BR> objDataReader.close()<BR> objConnection.close()<BR> end sub<BR><BR><BR>this is pulling info from a drop down box. anyone know what the problem could be?? <BR>