Array Binding
2004-11-16 09:23
302 查看
...
// Create an array of values that need to be inserted
int[] myArrayDeptNo = new int[3]{10, 20, 30};
// Set the command text on an OracleCommand object
cmd.CommandText = "insert into dept(deptno) values (:deptno)";
// Set the ArrayBindCount to indicate the number of values
cmd.ArrayBindCount = 3;
// Create a parameter for the array operations
OracleParameter prm = new OracleParameter("deptno", OracleDbType.Int32);
prm.Direction = ParameterDirection.Input;
prm.Value = myArrayDeptNo;
// Add the parameter to the parameter collection
cmd.Parameters.Add(prm);
// Execute the command
cmd.ExecuteNonQuery();
// Create an array of values that need to be inserted
int[] myArrayDeptNo = new int[3]{10, 20, 30};
// Set the command text on an OracleCommand object
cmd.CommandText = "insert into dept(deptno) values (:deptno)";
// Set the ArrayBindCount to indicate the number of values
cmd.ArrayBindCount = 3;
// Create a parameter for the array operations
OracleParameter prm = new OracleParameter("deptno", OracleDbType.Int32);
prm.Direction = ParameterDirection.Input;
prm.Value = myArrayDeptNo;
// Add the parameter to the parameter collection
cmd.Parameters.Add(prm);
// Execute the command
cmd.ExecuteNonQuery();
相关文章推荐
- 中国历代帝王之最
- Java学习从入门到精通
- 利用存储过程来消除数据库中冗余的数据
- Window下JSP环境的搭建
- 爱因斯坦谜语
- 续:利用XML实现通用WEB报表打印(实现篇)
- Socket编程之Connect超时
- 封装游标存储过程(Pr_execsql2)
- 利用XML实现通用WEB报表打印
- DOM4J 使用简介(转)
- COM组件转成.NET组件
- 使用属性和反射过渡从数据存取层到业务物件I
- my daughter
- 一美女莫名晕倒,被七男人强行拖入森林
- (转)eclipse的插件安装问题解决
- ADO 与ADO.NET
- 如何把string解析为int?[C#]
- 取得页面执行时间的代码
- JAVA代码编写的30条建议 选择自 chinaewolf 的 Blog
- 通胀使7000亿居民资产消失 谁从负利率中受益?