No data in data grid

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
 
C

Cowboy \(Gregory A. Beamer\)

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!
**********************************************************************
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top