错误是````
未处理的“System.NullReferenceException”类型的异常出现在 abc.dll 中。其他信息: 未将对象引用设置到对象的实例。指向是
sqlString.Append(" UPDATE TSUInStoreM SET CPVDID='"+table.Rows[0]["供应商编号"].ToString()+"' WHERE CSUInStoreID='"+this.dS_SUInStoreView.TSUInStoreM[0].CSUInStoreID.ToString()+"'");这是所有代码 为什么过不去~` 谁能给我讲讲啊``谢谢了!!!!!!!!!!!!!!!!
DataTable table = null;
table = HisenBA.Common.Dialog.SysInfo.ShowSelectDialog("tprovider");
// System.Text.StringBuilder sqlString = new System.Text.StringBuilder();
// sqlString.Append(" BEGIN TRAN");
//
// sqlString.Append(" UPDATE TSUInStoreM SET CPVDID='"+table.Rows[0]["供应商编号"].ToString()+"' WHERE CSUInStoreID='"+this.dS_SUInStoreView.TSUInStoreM[0].CSUInStoreID.ToString()+"'");
// sqlString.Append(" IF (@@ERROR<>0)");
// sqlString.Append(" BEGIN");
// sqlString.Append("  ROLLBACK TRAN");
// sqlString.Append("  RETURN");
// sqlString.Append(" END");
// sqlString.Append(" UPDATE TPAMoney SET CPVDID='"+table.Rows[0]["供应商编号"].ToString()+"' WHERE (CTBRGID='0503') AND (COriginID='"+this.dS_SUInStoreView.TSUInStoreM[0].CSUInStoreID.ToString()+"')");
// sqlString.Append(" IF (@@ERROR<>0)");
// sqlString.Append(" BEGIN");
// sqlString.Append("  ROLLBACK TRAN");
// sqlString.Append("  RETURN");
// sqlString.Append(" END");
// sqlString.Append(" COMMIT");

// if (!this.ws_Common.ExecuteString(sqlString.ToString()))
// {
// HisenBA.Common.Dialog.SysInfo.ShowMessage(1,"修改数据错误!");
// this.Close();
// }
this.theRefresh();
if (table != null)
{
table.Dispose();
}
// }
// else if (this.OperState < TOperState.UnConfirmView)
// { // table = HisenBA.Common.Dialog.SysInfo.ShowSelectDialog("tprovider");
// if ((null != table) && (table.Rows.Count > 0))
// {
// //this.BindingContext[dS_SUInStoreView,"TSUInStoreM"].SuspendBinding();
// dS_SUInStoreView.TSUInStoreM[0].CPVDID = table.Rows[0]["供应商编号"].ToString();
// dS_SUInStoreView.TSUInStoreM[0].CPVDName = table.Rows[0]["供应商名称"].ToString();
// this.BindingContext[dS_SUInStoreView,"TSUInStoreM"].ResumeBinding();
// }
if (table != null)
{
//table.Dispose();
System.Windows.Forms.MessageBox.Show("11111");
this.textBox2.Focus();
}

解决方案 »

  1.   

    table = HisenBA.Common.Dialog.SysInfo.ShowSelectDialog("tprovider");
    没有得到值
    table为null,所以table.Rows[0]["供应商编号"].ToString()出错
      

  2.   

    我打印table打出了这个 TChoicelist   可是在数据库里没有这个表啊 这是什么意思!?
      

  3.   

    一般出现这种情况就意味着你的语句中要引用的变量值为空this.dS_SUInStoreView.TSUInStoreM[0].CSUInStoreID.ToString()=null
      

  4.   

    高手门谁能告诉我 怎么往这个里面填植`` DataTable table
    我没分了``就请帮我解答了把