command.ExecuteNonQuery();前面的connection,和sql语句都定义好了,可是怎么还报错哦,代码如下:
usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text.Regular...
using System;using System.Collections.Generic;using System.Linq;
using System.Text.RegularExpressions;
using System.Reflection;
using System.Text;using System.Data.OleDb;using System.Data.OracleClient; using System.DataSystem.Data.OracleClient.OracleCommand;
namespace ConsoleApplication2{ class jlxy { static void Main(string[] args) { string connStr = "Data Source=pbex;Persist Security Info=True;User ID=pbex;Password=pbex;Unicode=True"; string sqlstr = "insert into jlxiaxin values( 'c',22);";
using (OracleConnection conn = new OracleConnection(connStr)) { OracleCommand command = new OracleCommand(sqlstr, conn); command.Connection.Open(); command.ExecuteNonQuery(); }} 展开
using System.Text.RegularExpressions;
using System.Reflection;
using System.Text;using System.Data.OleDb;using System.Data.OracleClient; using System.DataSystem.Data.OracleClient.OracleCommand;
namespace ConsoleApplication2{ class jlxy { static void Main(string[] args) { string connStr = "Data Source=pbex;Persist Security Info=True;User ID=pbex;Password=pbex;Unicode=True"; string sqlstr = "insert into jlxiaxin values( 'c',22);";
using (OracleConnection conn = new OracleConnection(connStr)) { OracleCommand command = new OracleCommand(sqlstr, conn); command.Connection.Open(); command.ExecuteNonQuery(); }} 展开
2个回答
2013-08-21
展开全部
OracleCommand command = new OracleCommand(sqlstr, conn); command.Connection.Open(); 错误应该在这里,应该是,conn.Open(command);
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-08-21
展开全部
把具体报错的信息发上来看下。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询