MySQLConnection conn = null; conn = new MySQLConnection(new MySQLConnectionString("localhost", "examonline_db", "root", "Liuyang").AsString); conn.Open(); string sql = "select * from studentregist_t where userName=@userName ";
MySQLCommand commn = new MySQLCommand(sql, conn);
commn.CommandType = CommandType.Text; commn.Parameters.Add("@userName", DbType.String);
commn.Parameters["@userName"].Value = "Liuyang"; MySQLDataAdapter mda = new MySQLDataAdapter(commn); DataSet ds = new DataSet(); mda.Fill(ds, "table1");
conn.Close();
this.dataGrid1.DataSource = ds.Tables["table1"];
“mda.Fill(ds, "table1");
”调试错误提示:对 PInvoke 函数“MySQLDriverCS!MySQLDriverCS.CPrototypes::mysql_real_escape_string”的调用导致堆栈不对称。原因可能是托管的 PInvoke 签名与非托管的目标签名不匹配。请检查 PInvoke 签名的调用约定和参数与非托管的目标签名是否匹配。mysql
MySQLCommand commn = new MySQLCommand(sql, conn);
commn.CommandType = CommandType.Text; commn.Parameters.Add("@userName", DbType.String);
commn.Parameters["@userName"].Value = "Liuyang"; MySQLDataAdapter mda = new MySQLDataAdapter(commn); DataSet ds = new DataSet(); mda.Fill(ds, "table1");
conn.Close();
this.dataGrid1.DataSource = ds.Tables["table1"];
“mda.Fill(ds, "table1");
”调试错误提示:对 PInvoke 函数“MySQLDriverCS!MySQLDriverCS.CPrototypes::mysql_real_escape_string”的调用导致堆栈不对称。原因可能是托管的 PInvoke 签名与非托管的目标签名不匹配。请检查 PInvoke 签名的调用约定和参数与非托管的目标签名是否匹配。mysql
解决方案 »
- VS支持oracle11g吗
- vs2010中dropdownlist 根据confirm信息执行后台代码
- sqlserver 如何生成一个字母加数字组合唯一的编号
- 如何获取主机系统服务列表``
- ultralGrid 更新問題?
- Global报错:<%@ Application Codebehind="Global.asax.vb" Inherits="FLCP2006.Global" %>这一行的内容在那里可以修改啊?
- 怎么样把在datagrid修改的数据存储起来并更新数据源
- 在一个web页面中的所有文本框等控件集合是什么?在foreach中怎么写(object o in ? )?
- 大散分只请各位伸出友爱之手鼓励一下,支持一下,谢谢了
- VS2012中添加引用之后解析为false
- try 无效,还是报错
- BASE64编码 与 加密
mda.Fill(ds, "table1");
后面加上datatableDataTable dt = ds.Tables["table1"];
this.dataGrid1.DataSource = dt;
this.dataGrid1.DataBind();你那conn.Close();放最后把。在数据还没取完就close怎么行啊conn.Close();
希望可以帮到你
conn = new MySQLConnection(new MySQLConnectionString("localhost", "examonline_db", "root", "Liuyang").AsString);
conn.Open();
string sql = "select * from studentregist_t where userName=?userName ";
MySQLCommand commn = new MySQLCommand(sql, conn);
commn.CommandType = CommandType.Text;
commn.Parameters.Add("?userName", DbType.String);
commn.Parameters["?userName"].Value = "Liuyang";
MySQLDataAdapter mda = new MySQLDataAdapter(commn);
DataSet ds = new DataSet();
mda.Fill(ds, "table1");
conn.Close();
this.dataGrid1.DataSource = ds.Tables["table1"];