MySql连接 [英] MySql Connection
本文介绍了MySql连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请为此提供帮助:
我收到错误消息:输入字符串的格式不正确."当我运行此代码片段时.我认为一切都很好
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
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();
}
问题在于方法GetShema("Tables")
The problem is with method GetShema("Tables")
Thanks in anticipation.
推荐答案
您在
中传递了错误的值
You are passing wrong value in
DataTable myDt = myConn.GetSchema("Tables");
表示表格"的值是错误的
请参见将值传递给Getshema函数
寻求帮助.
同样,如果不使用名称空间,则该名称空间是自定义名称空间,然后使用
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. :)
这篇关于MySql连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文