把MySQLDriverCS.dll导入VS2005,连接数据库,代码如下
using System.Text;
using System.Windows.Forms;
using System.Data.Odbc;
using System.Data.SqlClient;
using MySQLDriverCS;
namespace WindowsApplication5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
try
{
MySQLConnection con = new MySQLConnection("server=localhost;uid=root;pwd=111;database=test");
con.Open();
MySQLCommand cmd = new MySQLCommand("select * from aa", con); 错误提示:MySqlDriverCS.MySqlExecption:MySQLDriverCS Exception :MySQLDriverCS Error:
can't connect Access denied for user 'ODBC'@'localhost' (using password :NO)
在 MySQLDriverCS.MySQLConnection.Open()
在windowsApplication1.Form1.Form1_Load(Object sender,EventArgs e)位置也就是数据打不开,网上的资料都这么写的.为什么我这个不行呢~~~~
using System.Text;
using System.Windows.Forms;
using System.Data.Odbc;
using System.Data.SqlClient;
using MySQLDriverCS;
namespace WindowsApplication5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
try
{
MySQLConnection con = new MySQLConnection("server=localhost;uid=root;pwd=111;database=test");
con.Open();
MySQLCommand cmd = new MySQLCommand("select * from aa", con); 错误提示:MySqlDriverCS.MySqlExecption:MySQLDriverCS Exception :MySQLDriverCS Error:
can't connect Access denied for user 'ODBC'@'localhost' (using password :NO)
在 MySQLDriverCS.MySQLConnection.Open()
在windowsApplication1.Form1.Form1_Load(Object sender,EventArgs e)位置也就是数据打不开,网上的资料都这么写的.为什么我这个不行呢~~~~
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货