J
jiangyh
hey guys:
I use SqlDataAdapt.update method to update database that appearance an
error looks like following.
Update unable to find TableMapping['Table'] or DataTable 'Table'.
Here is My Code
//----------------------------------------------------------
SqlCommand _mInsertSqlCommand = (SqlCommand)this.GetCommand(true);
for(int i = 0; i < _mDataSet.Tables[0].Columns.Count; i++)
{
_mInsertSqlCommand.Parameters.Add(
new SqlParameter(
"@p" + _mDataSet.Tables[0].Columns.ColumnName,
this.setSqlDbTypeInfoFromType(_mDataSet.Tables[0].Columns.DataType),
_mDataSet.Tables[0].Columns.MaxLength,
_mDataSet.Tables[0].Columns.ColumnName.ToUpper()));
}
_mInsertSqlCommand.CommandText = _mStrSql;
_mInsertSqlCommand.CommandType = CommandType.Text;
SqlDataAdapter _mSqlInsertDataAdapter = new SqlDataAdapter();
_mSqlInsertDataAdapter.InsertCommand = _mSqlCommand;
_mSqlInsertDataAdapter.Update(_mDataSet);
//----------------------------------------------------------
thanks in advance
jiangyh
I use SqlDataAdapt.update method to update database that appearance an
error looks like following.
Update unable to find TableMapping['Table'] or DataTable 'Table'.
Here is My Code
//----------------------------------------------------------
SqlCommand _mInsertSqlCommand = (SqlCommand)this.GetCommand(true);
for(int i = 0; i < _mDataSet.Tables[0].Columns.Count; i++)
{
_mInsertSqlCommand.Parameters.Add(
new SqlParameter(
"@p" + _mDataSet.Tables[0].Columns.ColumnName,
this.setSqlDbTypeInfoFromType(_mDataSet.Tables[0].Columns.DataType),
_mDataSet.Tables[0].Columns.MaxLength,
_mDataSet.Tables[0].Columns.ColumnName.ToUpper()));
}
_mInsertSqlCommand.CommandText = _mStrSql;
_mInsertSqlCommand.CommandType = CommandType.Text;
SqlDataAdapter _mSqlInsertDataAdapter = new SqlDataAdapter();
_mSqlInsertDataAdapter.InsertCommand = _mSqlCommand;
_mSqlInsertDataAdapter.Update(_mDataSet);
//----------------------------------------------------------
thanks in advance
jiangyh