SqlConnection con = new SqlConnection();
SqlCommand dcmd = new SqlCommand();
DataTable dt = new DataTable();
string strEmpID = "1";
con.ConnectionString=
ConfigurationManager.ConnectionStrings["myconnection"].ConnectionString;
con.Open();
dcmd = new SqlCommand("SP_GetEmployeeByID", con);
dcmd.CommandType = CommandType.StoredProcedure;
dcmd.CommandTimeout = 0;
try
{
dcmd.Parameters.AddWithValue("@EmpID", strEmpID);
SqlDataAdapter mySqlAdapter = new SqlDataAdapter(dcmd);
mySqlAdapter.Fill(dt);
}
catch
{
throw;
}
finally
{
dcmd.Dispose();
con.Close();
}
0 comments
Post a Comment