Hi all...
Sorry about this... got another question for ya.. whats wrong with this..
string connectionString = ConfigurationSettings.AppSettings["ConnectionString"];
System.Data.SqlClient.SqlConnection sqlconnection = new System.Data.SqlClient.SqlConnection(connectionString);
string queryString = "SELECT MAX ([book].[PriKey]) FROM [book]";
System.Data.SqlClient.SqlCommand Mycommand = new System.Data.SqlClient.SqlCommand(queryString, sqlconnection);
System.Data.SqlClient.SqlDataReader dr;
dr = Mycommand.ExecuteReader(CommandBehavior.CloseConnection);
while (dr.Read())
{
DropDownList ModelNumber = (DropDownList)Form.FindControl("ModelNumber");
ModelNumber.Items.Add(new ListItem((String)dr["FirstName"] + dr["LastName"], ""));
}
dr.Close();
the error I'm getting is this...
ExecuteReader requires an open and available Connection. The connection's current state is closed.
Thanks again...
Stelly
Sorry about this... got another question for ya.. whats wrong with this..
string connectionString = ConfigurationSettings.AppSettings["ConnectionString"];
System.Data.SqlClient.SqlConnection sqlconnection = new System.Data.SqlClient.SqlConnection(connectionString);
string queryString = "SELECT MAX ([book].[PriKey]) FROM [book]";
System.Data.SqlClient.SqlCommand Mycommand = new System.Data.SqlClient.SqlCommand(queryString, sqlconnection);
System.Data.SqlClient.SqlDataReader dr;
dr = Mycommand.ExecuteReader(CommandBehavior.CloseConnection);
while (dr.Read())
{
DropDownList ModelNumber = (DropDownList)Form.FindControl("ModelNumber");
ModelNumber.Items.Add(new ListItem((String)dr["FirstName"] + dr["LastName"], ""));
}
dr.Close();
the error I'm getting is this...
ExecuteReader requires an open and available Connection. The connection's current state is closed.
Thanks again...
Stelly