Problem with datagrid

tchavez

Member
Joined
Nov 11, 2005
Messages
21
Programming Experience
1-3
Im have a problem with a datagrid. when i run the sql statement to populate it, it gets the header field and displays it but it doesnt populate any other data. When I run the same statement on the sql server i get results.

Private Sub GetR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GetR.Click
Dim conn As String = _
"server='host'; user id='user;password='pwd'; database='db'"
Dim objconn As New MySqlConnection(conn)
Dim GetRecipeGo As New MySqlCommand("GR", objconn)
GetRecipeGo.CommandType = CommandType.Text
GetRecipeGo.CommandText =
"Select `instructions` From `book` Where `recipe` =" + "'" + rName.Text + "'"
Dim GetRecipeGoItem As New MySql.Data.MySqlClient.MySqlDataAdapter(GetRecipeGo)
Dim GetBook As New DataSet()
Dim GetBookT As New DataTable()
GetRecipeGoItem.Fill(GetBook,
"GetBookT")
IngredView.DataSource = GetBook.Tables(
"GetBookT")
 
Check your connection string. I think it misses a ' after the user. Probably that is the problem. You may not face this problem in SQL server since you will be running inside the database in query analyser.

Varadarajan R

"server='host'; user id='user;password='pwd'; database='db'"
 
Back
Top