An exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll

前端 未结 6 1220
醉梦人生
醉梦人生 2020-12-16 04:07

When I execute my code below, this error message occurs:

"An exception of type \'System.Data.SqlClient.SqlException\' occurred in System.Data.dll bu

6条回答
  •  心在旅途
    2020-12-16 04:34

    Try this

    SqlCommand cmd = new SqlCommand("SELECT EmpName FROM Employee WHERE EmpID=@id", con);
    cmd.Parameters.AddWithValue("id", id.Text);
    

提交回复
热议问题