ODBC MySQL - Problems.

  • Thread starter Matthew Workman
  • Start date
M

Matthew Workman

Hi...

I am trying to do a "basic" ODBC connection to my MYSQL Database being
hosted at discountasp. For the life of me, I can't get anything to return...
could someone lend a hand? Here is my code:

--------------------------------

string MyConString = "DRIVER={MySQL ODBC 3.51 Driver};" +
"SERVER=hostnameatdiscountasp;" +
"DATABASE=myassigneddatabase;" +
"UID=;" +
"PASSWORD=;" +
"OPTION=3";

OdbcConnection MyConnection = new OdbcConnection(MyConString);
MyConnection.Open();

OdbcCommand MyCommand = new OdbcCommand();
MyCommand.CommandText = "SELECT * FROM sometesttable";

OdbcDataReader MyDataReader;

MyDataReader = MyCommand.ExecuteReader();

while (MyDataReader.Read())
{
Label1.Text = MyDataReader.GetString(1);
}

MyDataReader.Close();
MyConnection.Close();

----------------------------

Any ideas on what might be the problem?

Thanks a bunch.

Matthew Workman
TLWI
 
N

Nicholas Paldino [.NET/C# MVP]

Matthew,

Are you getting no records returned, or are you getting an exception?
Can you be more specific about what the problem is?
 

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

Top