B
Bob Hollness
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=localhost; user
id=test;password=password;database=documents;pooling=false"
Try
Dim TextConn As New MySqlConnection(ConnStr)
Dim TableAdaptor As New MySqlDataAdapter
'Dim CommBuild As New MySqlCommandBuilder
Dim TextDataTable As New DataTable
TextConn.Open()
TableAdaptor = New MySqlDataAdapter("SELECT * FROM daniel",
TextConn)
'CommBuild = New MySqlCommandBuilder(TableAdaptor)
TableAdaptor.Fill(TextDataTable)
TextGrid.DataSource = TextDataTable
IDBox.Text = TextGrid.Items.Count
'TitleBox.Text = TextDataTable.Columns.Count
BodyBox.Text = "Success"
Catch ex As Exception
BodyBox.Text = ex.Message
End Try
Thanks.
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=localhost; user
id=test;password=password;database=documents;pooling=false"
Try
Dim TextConn As New MySqlConnection(ConnStr)
Dim TableAdaptor As New MySqlDataAdapter
'Dim CommBuild As New MySqlCommandBuilder
Dim TextDataTable As New DataTable
TextConn.Open()
TableAdaptor = New MySqlDataAdapter("SELECT * FROM daniel",
TextConn)
'CommBuild = New MySqlCommandBuilder(TableAdaptor)
TableAdaptor.Fill(TextDataTable)
TextGrid.DataSource = TextDataTable
IDBox.Text = TextGrid.Items.Count
'TitleBox.Text = TextDataTable.Columns.Count
BodyBox.Text = "Success"
Catch ex As Exception
BodyBox.Text = ex.Message
End Try
Thanks.