static void Main(string[] args)
{
OleDbConnection thisConnection = new OleDbConnection("data source=local;User Id=user_name;Password=pwd;Provider=SQLOLEDB;"); OleDbCommand thisCommand = new OleDbCommand("select std_id,std_name,std_gender,std_age from student;", thisConnection); OleDbDataReader thisReader = null; try
{
thisConnection.Open();
thisReader = thisCommand.ExecuteReader();
while (thisReader.Read())
{
Console.WriteLine("\t{0}\t{1}\t{2}\t{3}", thisReader["std_id"], thisReader["std_name"], thisReader["std_gender"], thisReader["std_age"]);
}
thisReader.Close();
thisConnection.Close();
}
catch (Exception e) {
Console.WriteLine(e.ToString());
Console.WriteLine("throws a exception!!!");
}
Console.ReadKey();
}
当我运行以后:
新手上路,多多关照求解:1.data sourse指的是什么?
2.出现上图的情况,有什么解决的方法吗?
3.我的代码不知道哪里有没有问题,第一次写,如果有不合理的地方,请大侠们指点指点。O(∩_∩)O谢谢
{
OleDbConnection thisConnection = new OleDbConnection("data source=local;User Id=user_name;Password=pwd;Provider=SQLOLEDB;"); OleDbCommand thisCommand = new OleDbCommand("select std_id,std_name,std_gender,std_age from student;", thisConnection); OleDbDataReader thisReader = null; try
{
thisConnection.Open();
thisReader = thisCommand.ExecuteReader();
while (thisReader.Read())
{
Console.WriteLine("\t{0}\t{1}\t{2}\t{3}", thisReader["std_id"], thisReader["std_name"], thisReader["std_gender"], thisReader["std_age"]);
}
thisReader.Close();
thisConnection.Close();
}
catch (Exception e) {
Console.WriteLine(e.ToString());
Console.WriteLine("throws a exception!!!");
}
Console.ReadKey();
}
当我运行以后:
新手上路,多多关照求解:1.data sourse指的是什么?
2.出现上图的情况,有什么解决的方法吗?
3.我的代码不知道哪里有没有问题,第一次写,如果有不合理的地方,请大侠们指点指点。O(∩_∩)O谢谢
解决方案 »
- Oracle 10g 安装 “Checking swap space” Failed
- 数据库使用聚合函数或者排序时磁盘100%。请问是什么问题
- ORACLE9I 维护、优化
- 如何在2个不同的数据库服务器之间拷贝数据??
- 请问Oracle为什么要把重做日志组分组?
- 如何在PROC中调用带数组参数的存储过程啊!
- 我怎样把EXCEL的数据导入ORACLE数据库中?
- 问题急求帮助!Oracle用Exp命令导出数据问题!!!
- 数据库转移应注意那些问题 有道理就有分
- 高手帮忙--快照问题
- oracle 中一个字符串放在 varchar2(100)和varchar2(4000)字段中用的空间都是一样的吗?如果一样还用定义长度干什么?
- ORACLE写存储过程报错
data sourse指的是你要连接oracle的服务名。
你改成Data Source=orcl;Persist Security Info=True;User ID=user_name;Password=pwd
试一试!!