展开全部
string connStr = "Provider=MSDAORA;Data Source=dbname;User ID=user_name;Password=sa;Unicode=True"; //dbname是你的数据库名 user_name是你的数据库登陆名
//sa是密码
string sqlStr = "select * from baojing";
OleDbConnection oledbconn = new OleDbConnection(connStr); //新建个数据库联接
OleDbCommand oledbcom = new OleDbCommand(sqlStr, oledbconn);
oledbconn.Open();
OleDbDataAdapter adp = new OleDbDataAdapter(oledbcom);
DataSet ds1=new DataSet();
adp.Fill(ds1, "srctable");
/*
下一步就是new一个数据显示空间,把datasource设为ds1
别忘了这个:using System.Data.OleDb;
*/
//sa是密码
string sqlStr = "select * from baojing";
OleDbConnection oledbconn = new OleDbConnection(connStr); //新建个数据库联接
OleDbCommand oledbcom = new OleDbCommand(sqlStr, oledbconn);
oledbconn.Open();
OleDbDataAdapter adp = new OleDbDataAdapter(oledbcom);
DataSet ds1=new DataSet();
adp.Fill(ds1, "srctable");
/*
下一步就是new一个数据显示空间,把datasource设为ds1
别忘了这个:using System.Data.OleDb;
*/
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询