Forum Moderators: open
lstMinCars.DataSource = maker.GetDistinctNumCar();
lstMinCars.DataTextField = "NumCar";
lstMinCars.DataBind();
for (int i = 0; i < lstMinCars.Items.Count; i++)
{lstMaxCars.Items.Add(lstMinCars.Items[i].Value.ToString());}
public SqlDataReader GetDistinctNumCar() {
SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
SqlCommand myCommand = new SqlCommand("MakerDistinctNumCar", myConnection);
myCommand.CommandType = CommandType.StoredProcedure;
myConnection.Open();
SqlDataReader result = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
return result;}
I guess my problem is finding the stored procedure. I know this is a loaded question, but where would one normally store these procedures? I am used to looking for an "includes" folder or "config.php" file. Is there a standard place where these would go in a site directory.
I'm a super noob with this framework.
public System.Data.DataView GetDistinctNumCar()
{
SqlConnection Conn = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
SqlCommand cmd = new SqlCommand("MakerDistinctNumCar", myConnection);
cmd.CommandType = CommandType.StoredProcedure;
System.Data.DataSet ds = new System.Data.DataSet();
System.Data.SqlClient.SqlDataAdapter adapter;
adapter = new System.Data.SqlClient.SqlDataAdapter(cmd);
adapter.Fill(ds);
System.Data.DataView dv = ds.Tables[0].DefaultView;
dv.Sort = "NumCar";
return dv;
}