, , - , . . -, , . , .. , havent .
, :
protected SqlCommand GetNewCmd()
{
SqlCommand objCmd = new SqlCommand();
objCmd.Connection = new SqlConnection(this.ConnString);
objCmd.CommandType = CommandType.StoredProcedure;
return objCmd;
}
protected SqlCommand GetNewCmd(string CmdText)
{
SqlCommand objCmd = new SqlCommand(CmdText,
new SqlConnection(this.ConnString));
objCmd.CommandType = CommandType.StoredProcedure;
return objCmd;
}
protected DataTable GetTable(SqlCommand objCmd)
{
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter();
try
{
da.SelectCommand = objCmd;
da.Fill(dt);
dt.DefaultView.AllowNew = false;
}
catch (Exception ex)
{
LogException(ex);
throw;
}
finally
{
Close(objCmd);
da.Dispose();
da = null;
}
return dt;
}
GetTable(), GetDataSet(), ExecuteScalarInt(), ExecuteScalarGuid() .. .
, , , . , :
public DataTable GetStages(int id)
{
SqlCommand cmd = GetNewCmd("dbo.GetStages");
cmd.Parameters.Add("@ID", SqlDbType.Int).Value = id;
return GetTable(cmd);
}
public void DeleteStage(int id)
{
SqlCommand cmd = GetNewCmd("dbo.DeleteStage");
cmd.Parameters.Add("@ID", SqlDbType.Int).Value = id;
ExecuteNonQuery(cmd);
}
script . . , , .
, - , :
GridView1.DataSource = cApp.DB.GetStages(id);
GridView1.DataBind();
( - , .)
, .. .
, , -, . , . , . , , , .
, .