lets say you want to Execute a StoredProcedure in your DAL, you will have something like this
public voidDisable_Grid_Contents()
{
strcon = GetConnectionString(DB);
con = new SqlConnection(strcon);
cmdselect = new SqlCommand();
cmdselect.CommandText = "dbo.Get_Pattern";
cmdselect.CommandTimeout = 0;
cmdselect.CommandType = CommandType.StoredProcedure;
cmdselect.Connection = con;
try
{
con.Open();
cmdselect.ExecuteNonQuery();
}
catch (SqlException ex)
{
lblErrorMessage.Text = ex.Message; //Your Error willl be display in a Label
}
finally
{
if (con != null)
{
con.Close();
}
}
}
Thank you for posting at Dotnetfunda
[Administrator]
Rajendra.prasad, if this helps please login to Mark As Answer. |
Reply | Alert Moderator