VS2005+SQlserver2000 SqlConnection con = new SqlConnection("server=(local);database=DSTransSvr;uid=sa;pwd=;");
try
{
con.Open();
SqlCommand cmd = new SqlCommand("Insert Into TBMANAGERUSER Values ( '999', 999' ,'999')", con);
cmd.ExecuteNonQuery();
Label1.Text = "OK!"; }
catch (Exception ex)
{
Label1.Text = "Error!"; }
finally
{
con.Close();
}
总是显示:Error!
为什么错在什么地方
try
{
con.Open();
SqlCommand cmd = new SqlCommand("Insert Into TBMANAGERUSER Values ( '999', 999' ,'999')", con);
cmd.ExecuteNonQuery();
Label1.Text = "OK!"; }
catch (Exception ex)
{
Label1.Text = "Error!"; }
finally
{
con.Close();
}
总是显示:Error!
为什么错在什么地方
try
{
con.Open();
SqlCommand cmd = new SqlCommand("Insert Into TBMANAGERUSER Values ( '999', 999' ,'999')", con);
cmd.ExecuteNonQuery();
Label1.Text = "OK!";}
catch (Exception ex)
{
Label1.Text = "Error!";}
catch(Exception e)
{
e.ToString();
//分析该错误提示。
}
finally
{
con.Close();
}