make sure you can read first:OleDbConnection oConn = new OleDbConnection(sConn);
OleDbCommand oCmd = new OleDbCommand( sSQL, oConn );
oConn.Open();
oCmd.CommandText = "Select count(*) as Count from owner.TABLE";
int n = (int)oCmd.ExecuteScalar();
oConn.Close();
oConn.Dispose();
OleDbCommand oCmd = new OleDbCommand( sSQL, oConn );
oConn.Open();
oCmd.CommandText = "Select count(*) as Count from owner.TABLE";
int n = (int)oCmd.ExecuteScalar();
oConn.Close();
oConn.Dispose();
并且按照你的刚才写的那代码,曾经执行过 SELECT * FROM 的子句,是没有问题的,能返回 DataTable来。
只要做更新操作就出问题了。在SQL Plus中做更新没有问题。
连接串没问题吧?试试
Provider=MSDAORA.1;Password=escmuser;User ID=escmuser;Data Source=escm
是不是在链接字符串中还要设置其它什么东东?比如:Extended Propertores=???
"Extended Properties=;Persist Security Info=True;"it is weird that your program hung instead of giving your errors, sounds like a lock problem, but that will give you an eventual error
二、Provider="OraOLEDB.Oracle";User ID=escmuser;Data Source=escm;Extended Properties=;Persist Security Info=True;Password=escmuser
三、Provider="OraOLEDB.Oracle";User ID=escmuser;Data Source=escm;Password=escmuser
三、Provider="OraOLEDB.Oracle.1";User ID=escmuser;Data Source=escm;Extended Properties=;Persist Security Info=True;Password=escmuser
四、Provider="OraOLEDB.Oracle.1";User ID=escmuser;Data Source=escm;Password=escmuser
OleDbConnection Conxxwgl = new OleDbConnection(ConfigurationSettings.AppSettings["ConnXxwgl"]);
string Str1 = "select count(*) from xxwt_sb_jbxx where sbbh = '" + StrSbbh +"'";
OleDbCommand OleCmdMsg = new OleDbCommand(Str1,Conxxwgl);
Conxxwgl.Open();
int intCount = int.Parse(OleCmdMsg.ExecuteScalar().ToString());
Conxxwgl.Close();
if (intCount>0)
{
string StrJsjm = "select jsjm from xxwt_sb_jbxx where sbbh = '" + StrSbbh +"'";
OleDbCommand OleCmdMsg1 = new OleDbCommand(StrJsjm,Conxxwgl);
Conxxwgl.Open();
txtjsjm.Text = OleCmdMsg1.ExecuteScalar().ToString();
Conxxwgl.Close();
}
else
{
Response.Write("<script language='javascript'>alert('没有对应的计算机名称!')</script>"); }
你把你的那段ConfigurationSettings.AppSettings["ConnXxwgl"]的值告诉我???
try
{
//你的可执行代码;
}
catch(Exception err)
{
Debug.Fial(err.Message);//记得添加引用using System.Diagnostics;
}