No data in data grid

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

Hi,

I am using the following code to display some test data but the data
is not visible in the grid, only the headers appear. Not really sure
what else to do, I looked at examples on the web and I don't really
see a difference. Thanks for any help!

SqlDataAdapter1.SelectCommand.CommandText = "Select * from tbRace"
Dim ds5 As New DataSet
Dim strval As String = SqlDataAdapter1.SelectCommand.CommandText
SqlDataAdapter1.Fill(ds5, strval)
DataGrid1.DataSource = ds5.Tables(strval)
DataGrid1.DataBind()


Dave
 
Do not name a table "Select * from tbRace".

SqlDataAdapter1.Fill(ds5, "Race")
or
SqlDataAdapter1.Fill(ds5, "tbRace")

If this does not help, make sure the query returns results. You may have a
logical error with Syntax.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
 
Back
Top