public System.Data.OleDb.OleDbConnection strconn = null
//获取datatable数据
public DataTable AExcuToTable(string sql)
{
DataTable dv = null
// System.Data.OleDb.OleDbConnection strconn=null
try
{
strconn = new System.Data.OleDb.OleDbConnection(strConnection)
if (strconn.State == ConnectionState.Closed)
strconn.Open()
System.Data.OleDb.OleDbDataAdapter oa = new System.Data.OleDb.OleDbDataAdapter(sql, strconn)
System.Data.DataSet ds = new DataSet()
oa.Fill(ds, "Table")
dv = ds.Tables["Table"]
}
catch
{
return null
}
strconn.Close()
return dv
}
境是:win8,vs2013,mysql-5.0.22-win32;二、首先设置VS2013,引入mysql包;具体步骤参考链接
三、关于一些问题解决:
#include<winsock.h>
#include<mysql.h>
顺序不能改变,否则会出现语法错误
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)