Hi all. I hope this is the right group
I am trying to populate a datagrid on an ASP.NET page from a MySQL table
using the .NET connector (ByteFX). But for the life of me, I just cannot
work it out. Can someone tell me what I am doing wrong? What I want is to
click a button and the contents of the table from the DB appears in the
DataGrid on my ASP page.
I tried to follow an example on the web and I just got lost. I have posted
my code below.
Dim ConnStr As String
ConnStr = "server=localho st; user
id=test;passwor d=password;data base=documents; pooling=false"
Try
Dim TextConn As New MySqlConnection (ConnStr)
Dim TableAdaptor As New MySqlDataAdapte r
'Dim CommBuild As New MySqlCommandBui lder
Dim TextDataTable As New DataTable
TextConn.Open()
TableAdaptor = New MySqlDataAdapte r("SELECT * FROM daniel",
TextConn)
'CommBuild = New MySqlCommandBui lder(TableAdapt or)
TableAdaptor.Fi ll(TextDataTabl e)
TextGrid.DataSo urce = TextDataTable
IDBox.Text = TextGrid.Items. Count
'TitleBox.Text = TextDataTable.C olumns.Count
BodyBox.Text = "Success"
Catch ex As Exception
BodyBox.Text = ex.Message
End Try
Thanks.
--
Bob
--------------------------------------
I'll have a B please Bob.
I am trying to populate a datagrid on an ASP.NET page from a MySQL table
using the .NET connector (ByteFX). But for the life of me, I just cannot
work it out. Can someone tell me what I am doing wrong? What I want is to
click a button and the contents of the table from the DB appears in the
DataGrid on my ASP page.
I tried to follow an example on the web and I just got lost. I have posted
my code below.
Dim ConnStr As String
ConnStr = "server=localho st; user
id=test;passwor d=password;data base=documents; pooling=false"
Try
Dim TextConn As New MySqlConnection (ConnStr)
Dim TableAdaptor As New MySqlDataAdapte r
'Dim CommBuild As New MySqlCommandBui lder
Dim TextDataTable As New DataTable
TextConn.Open()
TableAdaptor = New MySqlDataAdapte r("SELECT * FROM daniel",
TextConn)
'CommBuild = New MySqlCommandBui lder(TableAdapt or)
TableAdaptor.Fi ll(TextDataTabl e)
TextGrid.DataSo urce = TextDataTable
IDBox.Text = TextGrid.Items. Count
'TitleBox.Text = TextDataTable.C olumns.Count
BodyBox.Text = "Success"
Catch ex As Exception
BodyBox.Text = ex.Message
End Try
Thanks.
--
Bob
--------------------------------------
I'll have a B please Bob.
Comment