Results 1 to 15 of 15

Thread: Datagrid not filling up [RESOLVED]

Threaded View

  1. #1

    Thread Starter
    Fanatic Member drpcken's Avatar
    Join Date
    Apr 2004
    Location
    devenv
    Posts
    591

    Datagrid not filling up [RESOLVED]

    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
    Last edited by drpcken; Jul 1st, 2004 at 08:21 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width