Click here to Skip to main content
15,894,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Please I need a help on this:
I am getting error: "Input string was not in a correct format." when I run this code snippet. Everything, I think, is ok



C#
using MySql.Data.MySqlClient;

private void button1_Click(object sender, EventArgs e)
{
  string connString = "Server=localhost;Database=mmt_gui;Uid=root;";

            MySqlConnection myConn = new MySqlConnection(connString);

            myConn.Open();           

            DataTable myDt = myConn.GetSchema("Tables");
            dataGridView1.DataSource = myDt;
            myConn.Close();
}

The problem is with method GetShema("Tables")
Thanks in anticipation.
Posted
Comments
DavidKiryazi 25-Aug-10 6:32am    
tosinp is that MySql a custom namespace?

1 solution

You are passing wrong value in

DataTable myDt = myConn.GetSchema("Tables");


means "Tables" is wrong value

See Passing Values to Getshema function
for help.

Also wheather the namespace is a custom made namespace if not then use

Sysytem.Data.Odbc


Hope this may help u. :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900