System.Data.OracleClient.dll方式操作oracle数据库
2024-10-20 05:23:06
System.Data.OracleClient.dll方式操作oracle数据库
一.查询语句:
using (OracleConnection conn = new OracleConnection(System.Configuration.ConfigurationManager.ConnectionStrings["local_Orcl"].ConnectionString))
{
conn.Open();
using (OracleCommand cmd = conn.CreateCommand())
{
try
{
cmd.CommandText = "select * from HLB_HIS_REQUISITION";
DataTable dt = null;
OracleDataAdapter adapter = new OracleDataAdapter();
adapter.SelectCommand = cmd;
dt = new DataTable();
adapter.Fill(dt);
cmd.Parameters.Clear(); dataGridView1.DataSource = dt;
}
catch (Exception ee)
{
MessageBox.Show(ee.Message.ToString() + "\r\n" + ee.StackTrace.ToString());
cmd.Dispose();
conn.Close();
conn.Dispose();
}
}
}
二.插入语句:
using (OracleConnection conn = new OracleConnection(System.Configuration.ConfigurationManager.ConnectionStrings["local_Orcl"].ConnectionString))
{
conn.Open();
using (OracleCommand cmd = conn.CreateCommand())
{
try
{
cmd.CommandText = "insert into hlb_his_requisition(requisition_id, patient_name, patient_sex, patient_age, patient_bed, charge_name, sample_class, requisition_state)values(1,'张三', 1, 1, 1, 1, 1, 1)";
cmd.ExecuteNonQuery();
}
catch (Exception ee)
{
MessageBox.Show(ee.Message.ToString() + "\r\n" + ee.StackTrace.ToString());
cmd.Dispose();
conn.Close();
conn.Dispose();
}
}
}
三.连接字符串:
<add name="local_Orcl" connectionString="Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.31.11)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL)));User ID=scott;Password=123"/>
四.是否乱码:
五.是否需要安装客户端:
最新文章
- noip2014-day2-t2
- [转]安卓开发startservice 和bindservice详解
- ios 开发中出现的 pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug
- 发生了COMException 异常来自 HRESULT:0x80040228
- B’QConf(北京软件质量大会)记
- android之Itent.ACTION_PICK Intent.ACTION_GET_CONTENT妙用
- Java这点事
- Windows Azure 基本操作手册
- 百度地图api之如何自定义标注图标
- Linux命令初步了解
- hibernate 核心总结 (面试)
- A Game of Thrones(14) - Catelyn
- 【netty这点事儿】ByteBuf 的使用模式
- android连接打印机
- 系列博文-LowPoly风格的图像生成器
- Ubuntu 开启远程登录 SSH 的安装和配置
- TabBar用到bottomNavigationBar
- gitlab备份
- [Cerc2012]Non-boring sequences
- 遇到问题无法在线上 debug,难道只能通过加日志再重新发布吗? 线上遇到某个用户的数据处理有问题,但线上同样无法 debug,线下无法重现! 是否有一个全局视角来查看系统的运行状况? 有什么办法可以监控到JVM的实时运行状态?
热门文章
- Ubuntu 安装 kamailio
- FreeSWITCH 启用多域(多租户)的配置
- AttributeUsage
- Scala基础:面向对象之对象和继承
- linux下项目开发加载动态库:ldconfig与 /etc/ld.so.conf
- RabbitMQ EasyNetq 用法
- jedis的publish/subscribe[转]含有redis源码解析
- [Cookie] Clear Cookie
- asp.net webform过滤器(注意我们可以在拦截请求的同时设置回调函数)
- 使用PPT演讲时,两个屏幕显示的内容不一样