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"/>

四.是否乱码:

五.是否需要安装客户端:

最新文章

  1. noip2014-day2-t2
  2. [转]安卓开发startservice 和bindservice详解
  3. ios 开发中出现的 pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug
  4. 发生了COMException 异常来自 HRESULT:0x80040228
  5. B’QConf(北京软件质量大会)记
  6. android之Itent.ACTION_PICK Intent.ACTION_GET_CONTENT妙用
  7. Java这点事
  8. Windows Azure 基本操作手册
  9. 百度地图api之如何自定义标注图标
  10. Linux命令初步了解
  11. hibernate 核心总结 (面试)
  12. A Game of Thrones(14) - Catelyn
  13. 【netty这点事儿】ByteBuf 的使用模式
  14. android连接打印机
  15. 系列博文-LowPoly风格的图像生成器
  16. Ubuntu 开启远程登录 SSH 的安装和配置
  17. TabBar用到bottomNavigationBar
  18. gitlab备份
  19. [Cerc2012]Non-boring sequences
  20. 遇到问题无法在线上 debug,难道只能通过加日志再重新发布吗? 线上遇到某个用户的数据处理有问题,但线上同样无法 debug,线下无法重现! 是否有一个全局视角来查看系统的运行状况? 有什么办法可以监控到JVM的实时运行状态?

热门文章

  1. Ubuntu 安装 kamailio
  2. FreeSWITCH 启用多域(多租户)的配置
  3. AttributeUsage
  4. Scala基础:面向对象之对象和继承
  5. linux下项目开发加载动态库:ldconfig与 /etc/ld.so.conf
  6. RabbitMQ EasyNetq 用法
  7. jedis的publish/subscribe[转]含有redis源码解析
  8. [Cookie] Clear Cookie
  9. asp.net webform过滤器(注意我们可以在拦截请求的同时设置回调函数)
  10. 使用PPT演讲时,两个屏幕显示的内容不一样