rwdMike
asked on
Cannot get GridView to display Data (VB.Net / VS2008
Hello,
I cannot get Gridview to show my data. I've tryed using a Datatable and a Oledb Reader. I've verified that both contain the data and the rows.
After the .databind call, i verify that the gridview has all 59 rows, but it doesn't display on the web page. I've already tried turning autogeneratecolumns to true
This is a sub in my default.aspx.vb file, which executes. Note that i've already instantiated the new gridview (Connectdb is a class with all db functions, dbQueryResult returns a datareader)
Any suggestions???
>>>> CODE <<<<<<
Dim dbConn As New Connectdb
If dbConn.dbConnect Then
sSQL = "Select LastName,FirstName FROM tblEmployees"
Dim dt As DataTable
dt = New DataTable
If dbConn.dbExecQuery(sSQL, gQueryType.ReaderQuery) Then
dt.Load(dbConn.dbQueryResu lt)
EmployeeGrid.DataSource = dt
EmployeeGrid.DataBind()
dbConn.dbClose()
End If
End If
<<<<<<< CODE >>>>>>
I cannot get Gridview to show my data. I've tryed using a Datatable and a Oledb Reader. I've verified that both contain the data and the rows.
After the .databind call, i verify that the gridview has all 59 rows, but it doesn't display on the web page. I've already tried turning autogeneratecolumns to true
This is a sub in my default.aspx.vb file, which executes. Note that i've already instantiated the new gridview (Connectdb is a class with all db functions, dbQueryResult returns a datareader)
Any suggestions???
>>>> CODE <<<<<<
Dim dbConn As New Connectdb
If dbConn.dbConnect Then
sSQL = "Select LastName,FirstName FROM tblEmployees"
Dim dt As DataTable
dt = New DataTable
If dbConn.dbExecQuery(sSQL, gQueryType.ReaderQuery) Then
dt.Load(dbConn.dbQueryResu
EmployeeGrid.DataSource = dt
EmployeeGrid.DataBind()
dbConn.dbClose()
End If
End If
<<<<<<< CODE >>>>>>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://www.aspnettutorials.com/tutorials/database/db-storedprocs-aspnet2-vb.aspx
http://www.ironspeed.com/Designer/6.2.1/Code%20Customizations/ShowCodeCustomization.aspx?codeCustomizationName=/Designer/6.2.1/Code%20Customizations/cs/Stored%20Procedures%20Customization/Populate%20GridView%20with%20Your%20Own%20Database%20Stored%20Procedures&displayType=code&scriptLanguage=vb
Hope it helps.
http://www.ironspeed.com/Designer/6.2.1/Code%20Customizations/ShowCodeCustomization.aspx?codeCustomizationName=/Designer/6.2.1/Code%20Customizations/cs/Stored%20Procedures%20Customization/Populate%20GridView%20with%20Your%20Own%20Database%20Stored%20Procedures&displayType=code&scriptLanguage=vb
Hope it helps.
EmployeeGrid.DataBind() then we can look at the front end code.