最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
.net+oracle+crystalReports开发web应用程序学习笔记(二)
时间:2022-07-02 10:51:36 编辑:袖梨 来源:一聚教程网
上次提到基本的配置注意问题,现在开始实际开发oracle中的问题
一 oracle 数据库的连接
但你装了oracle的客户端,在配置时就已经指定了数据库服务器,所以连接时主要由三个元素就可以连接上数据库,数据库的名称(即SID),用户名,密码
SqlConnection con=new SqlConnection("Provider=MSDAORA.1;User ID=UserID;Data Source=xf;Password=password")
而sql Server不需要安装客户端,所以必须指定服务器,和数据库名
SqlConnection con=new SqlConnection("workstation id=XIAOFENG;packet size=4096;user id=sa;integrated security=SSPI;data source=xiaofeng;persist security info=False;initial catalog=xf");
二 在oracle中运行包(Package)中的函数和存储过程。
举个例子,要运行下面一个sql语句:"select order_no,inventory_part_api.get_description(contract,part_no),part_no from SHOP_ORD where inventory_part_api.get_description(contract,part_no) like '%喜之郎25%果冻%'";
1.在.net设计中(如设计sqlDataAdapter)不能够直接使用包中的函数和存储过程,如果要使用,可以在设计时把包中要使用的函数和存储过程copy过来再设计时声明一遍,就可以使用
2.在.net运行时直接添加代码,系统会直接去寻中包中的内容
string strCommand;
strCommand="select order_no,inventory_part_api.get_description(contract,part_no),part_no from SHOP_ORD where inventory_part_api.get_description(contract,part_no) like '%喜之郎25%果冻%'";
OleDbConnection con=new OleDbConnection("Provider=MSDAORA.1;Password=password;User ID=UserID;Data Source=xf");
con.Open();
OleDbDataAdapter adapter=new OleDbDataAdapter(strCommand,con);
DataSet dataset = new DataSet();
一 oracle 数据库的连接
但你装了oracle的客户端,在配置时就已经指定了数据库服务器,所以连接时主要由三个元素就可以连接上数据库,数据库的名称(即SID),用户名,密码
SqlConnection con=new SqlConnection("Provider=MSDAORA.1;User ID=UserID;Data Source=xf;Password=password")
而sql Server不需要安装客户端,所以必须指定服务器,和数据库名
SqlConnection con=new SqlConnection("workstation id=XIAOFENG;packet size=4096;user id=sa;integrated security=SSPI;data source=xiaofeng;persist security info=False;initial catalog=xf");
二 在oracle中运行包(Package)中的函数和存储过程。
举个例子,要运行下面一个sql语句:"select order_no,inventory_part_api.get_description(contract,part_no),part_no from SHOP_ORD where inventory_part_api.get_description(contract,part_no) like '%喜之郎25%果冻%'";
1.在.net设计中(如设计sqlDataAdapter)不能够直接使用包中的函数和存储过程,如果要使用,可以在设计时把包中要使用的函数和存储过程copy过来再设计时声明一遍,就可以使用
2.在.net运行时直接添加代码,系统会直接去寻中包中的内容
string strCommand;
strCommand="select order_no,inventory_part_api.get_description(contract,part_no),part_no from SHOP_ORD where inventory_part_api.get_description(contract,part_no) like '%喜之郎25%果冻%'";
OleDbConnection con=new OleDbConnection("Provider=MSDAORA.1;Password=password;User ID=UserID;Data Source=xf");
con.Open();
OleDbDataAdapter adapter=new OleDbDataAdapter(strCommand,con);
DataSet dataset = new DataSet();
相关文章
- AI文档助手入口:改变文档处理方式的智能工具 07-19
- TRAE Work上线 40 万字的AI打工说明书:一手实测在此 07-19
- iwara网页版入口-iwara网页版访问地址 07-19
- 算力定价权的转移——从你有多少张卡到Token成本多少 07-19
- 在WAIC:第一次觉得AI不必那么聪明 07-19
- 天谱乐大模型发布4.7:让AI音乐更懂“二次创作”|独家 07-19