问题就是引用类型怎么转换成其他类型,我的这个程序中的方法不能通过,错误是:
行 67:int c=(int) b;
System.InvalidCastException: 指定的转换无效。
public void Button1_Click(object sender, System.EventArgs e)
{
SqlConnection sqlConnection1=new SqlConnection("data source=HEAVEN;initial catalog=data;User Id=sa;Password=''");
SqlCommand sqlCommand1=new SqlCommand ();
string a=TextBox1.Text;
Label1.Text=a;
object b=a;
int c=(int) b;
sqlCommand1.CommandText="Update data Set time=c where ID=0";
sqlCommand1.Connection = sqlConnection1;
sqlConnection1.Open();
sqlCommand1.ExecuteNonQuery();
sqlConnection1.Close();
}程序中的方法不能通过,错误是: