D
delphiyesterday
Unregistered / Unconfirmed
GUEST, unregistred user!
private void DataGrid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
int Pid=(int)e.Item.ItemIndex;
TextBox str_khjc=(TextBox)e.Item.Cells[2].Controls[0];
DataGrid1.EditItemIndex=-1;
String strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D://Inetpub//wwwroot//WebApplication_crm//Data//ASP.mdb;";
OleDbConnection OleConn=new OleDbConnection(strConn);
String strSQL="SELECT khbh AS 客户编号,khjc AS 客户简称,dh AS 电话,cz AS 传真,email AS EMAIL,xsdb AS 销售代表 FROM khxx WHERE khbh<>3000"+sqlstring;
OleDbDataAdapter objAdapter=new OleDbDataAdapter(strSQL,strConn);
DataSet objDataSet=new DataSet();
objAdapter.Fill(objDataSet,"dtkhxx");
DataTable objDataTable=objDataSet.Tables["dtkhxx"];
objDataTable.PrimaryKey=new DataColumn[]{objDataTable.Columns["客户编号"]};
DataRow row=objDataTable.Rows.Find(Pid);
row["客户简称"]=str_khjc.Text;
OleDbCommandBuilder cb=new OleDbCommandBuilder(objAdapter);
OleConn.Open();
objAdapter.Update(objDataSet,"dtkhxx");
OleConn.Close();
DataGrid1.DataSource=objDataSet.Tables["dtkhxx"];
DataGrid1.DataBind();
}
提示:"未将对象引用设置到对象的实例。"并在row["客户简称"]=str_khjc.Text;画红线.
{
int Pid=(int)e.Item.ItemIndex;
TextBox str_khjc=(TextBox)e.Item.Cells[2].Controls[0];
DataGrid1.EditItemIndex=-1;
String strConn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D://Inetpub//wwwroot//WebApplication_crm//Data//ASP.mdb;";
OleDbConnection OleConn=new OleDbConnection(strConn);
String strSQL="SELECT khbh AS 客户编号,khjc AS 客户简称,dh AS 电话,cz AS 传真,email AS EMAIL,xsdb AS 销售代表 FROM khxx WHERE khbh<>3000"+sqlstring;
OleDbDataAdapter objAdapter=new OleDbDataAdapter(strSQL,strConn);
DataSet objDataSet=new DataSet();
objAdapter.Fill(objDataSet,"dtkhxx");
DataTable objDataTable=objDataSet.Tables["dtkhxx"];
objDataTable.PrimaryKey=new DataColumn[]{objDataTable.Columns["客户编号"]};
DataRow row=objDataTable.Rows.Find(Pid);
row["客户简称"]=str_khjc.Text;
OleDbCommandBuilder cb=new OleDbCommandBuilder(objAdapter);
OleConn.Open();
objAdapter.Update(objDataSet,"dtkhxx");
OleConn.Close();
DataGrid1.DataSource=objDataSet.Tables["dtkhxx"];
DataGrid1.DataBind();
}
提示:"未将对象引用设置到对象的实例。"并在row["客户简称"]=str_khjc.Text;画红线.