public DataSet GetProviderTypeDs()
{
using (SqlConnection con = new SqlConnection(this.conStr))
{
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = @"select * from ProviderType";
con.Open();
SqlDataAdapter ada = new SqlDataAdapter(cmd);
ada.MissingSchemaAction = MissingSchemaAction.AddWithKey;
DataSet ds = new DataSet();
ada.Fill(ds,"ProviderType");
//先設(shè)置seed再設(shè)置step導(dǎo)致seed設(shè)置失敗,seed被設(shè)置為Table的標識列ID最大值
//ds.Tables[0].Columns[0].AutoIncrementSeed = -1;
//ds.Tables[0].Columns[0].AutoIncrementStep = -1;
ds.Tables[0].Columns[0].AutoIncrementStep = -1;
ds.Tables[0].Columns[0].AutoIncrementSeed = -1;
ds.Tables[0].Columns[0].ReadOnly = false;
return ds;
}
}
新聞標題:DataTable設(shè)置自增標識列的異常
網(wǎng)站地址:
http://weahome.cn/article/pojice.html