日期:2014-05-18  浏览次数:20643 次

PPC2003连接SQL2000出现“未处理SqlException”错误
代码都是自动生成的,也加了using System.Data.SqlClient;,为什么在倒数第二行就出现“未处理SqlException”错误,这该怎么改?
  private void InitConnection() {
  this._connection = new System.Data.SqlClient.SqlConnection();
  this._connection.ConnectionString = "Data Source=192.168.8.2;Initial Catalog=smartSchedule;Persist Security Info=True;" +
  "User ID=sa;Password=Aa123456;";
  }
   
  [System.Diagnostics.DebuggerNonUserCodeAttribute()]
  private void InitCommandCollection() {
  this._commandCollection = new System.Data.SqlClient.SqlCommand[1];
  this._commandCollection[0] = new System.Data.SqlClient.SqlCommand();
  this._commandCollection[0].Connection = this.Connection;
  this._commandCollection[0].CommandText = "SELECT 序号, 组件名, 条件序号, ERP品号 FROM dbo.bom类定义";
  this._commandCollection[0].CommandType = System.Data.CommandType.Text;
  }
   
  [System.Diagnostics.DebuggerNonUserCodeAttribute()]
  [System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Fill, true)]
  public virtual int Fill(smartScheduleDataSet.bom类定义DataTable dataTable) {
  this.Adapter.SelectCommand = this.CommandCollection[0];
  if ((this.ClearBeforeFill == true)) {
  dataTable.Clear();
  }
  int returnValue = this.Adapter.Fill(dataTable);
  return returnValue;

------解决方案--------------------
ding!!!!!!!!!!
------解决方案--------------------
我也遇到了类似问题,正常WinForm上就不会出现,Mobile上就会出现,而且这些代码是VS自动生成的,关注一下