[font=verdana, arial, helvetica]Usually I create my dataset, dataadapter manually in Visual Studio, but in this case, I need the dataadapter.SelectCommand to give me only rows that one column matches the value of a textbox on the webform. But it wouldn't let me do that, so I tried manualy coding the dataadapter, and dataset.
But when the page loads, there is no data in the datagrid. Am I misssing something??
Thanks again, here's the code. No errors on load, just no data in datagrid1. It shows the column headings. Pay special attention to the selectcommand of the dataadapter.
Private dsItems As New DataSet()
Private daItems As New SqlDataAdapter()
Private Sub LoadLineItems()
If SqlConnection1.State = ConnectionState.Closed Then SqlConnection1.Open()
daItems.SelectCommand = New SqlCommand("SELECT ItemNumber, Price, Quantity from dbLineItems where RecID = '" + txtRecId.Text + "'", SqlConnection1)
daItems.Fill(dsItems)
DataGrid1.DataSource = dsItems
DataGrid1.DataBind()
SqlConnection1.Close()
End Sub[/font]
But when the page loads, there is no data in the datagrid. Am I misssing something??
Thanks again, here's the code. No errors on load, just no data in datagrid1. It shows the column headings. Pay special attention to the selectcommand of the dataadapter.
Private dsItems As New DataSet()
Private daItems As New SqlDataAdapter()
Private Sub LoadLineItems()
If SqlConnection1.State = ConnectionState.Closed Then SqlConnection1.Open()
daItems.SelectCommand = New SqlCommand("SELECT ItemNumber, Price, Quantity from dbLineItems where RecID = '" + txtRecId.Text + "'", SqlConnection1)
daItems.Fill(dsItems)
DataGrid1.DataSource = dsItems
DataGrid1.DataBind()
SqlConnection1.Close()
End Sub[/font]