/// <summary> /// 执行sql,返回DataSet /// </summary> /// <param name="strSql"></param> /// <param name="DataSet"></param> /// <returns></returns> public int ExecQuery(string strSql, ref DataSet DataSet) { a: CloseRead(); this.command.Connection = this.con as IBM.Data.DB2.DB2Connection; this.command.CommandType = System.Data.CommandType.Text; this.command.Parameters.Clear(); this.command.CommandText = strSql + ""; try { IBM.Data.DB2.DB2DataAdapter adapter = new IBM.Data.DB2.DB2DataAdapter(this.command); adapter.Fill(DataSet); } catch (IBM.Data.DB2.DB2Exception ex) { this.Err = "执行产生错误!" + ex.Message; this.ErrCode = strSql; this.DBErrCode = 1; this.WriteErr(); //[2007/11/28]先不改,下面代码是ORACLE专用的 //if (ex.Number == 3113) //{ // while (this.Connect(this.con.ConnectionString) == -1) // { // } // goto a; //} //end; if (this.con.State != ConnectionState.Open) { this.con.Open(); goto a; } return(-1); } catch (Exception ex) { this.Err = "执行语句产生错误!" + ex.Message; this.ErrorException = ex.InnerException + "+ " + ex.Source; this.ErrCode = strSql; this.WriteErr(); return(-1); } WriteDebug("执行查询sql语句!" + strSql); return(0); }
public DB2CommandBuilder(IBM.Data.DB2.DB2DataAdapter adapter) { }