string sel="select ident_current('tableid') as iCount";
SqlCommand cmd=new SqlCommand(sel,myConnection);
cmd.Connection.Open();
SqlDataReader dr=cmd.ExecuteReader();
while(dr.Read())
{
bh_new=Int32.Parse(dr["iCount"].ToString());
}
dr.Close();
cmd.Connection.Close();
为什么说输入字符串格式不正确呢
SqlCommand cmd=new SqlCommand(sel,myConnection);
cmd.Connection.Open();
SqlDataReader dr=cmd.ExecuteReader();
while(dr.Read())
{
bh_new=Int32.Parse(dr["iCount"].ToString());
}
dr.Close();
cmd.Connection.Close();
为什么说输入字符串格式不正确呢
{
string icount = 1;
if (dr["iCount"] != DbNull.Value)
{
icount = dr["iCount"].ToString();
}
bh_new=Int32.Parse(icount);
}