Below is the code used to get data from sql into visual studio:
publicstaticDataTable GetData(string selectCommand,DataTable datatable)
{
datatable.Clear();
SqlConnection conn = newSqlConnection("Connection string");
SqlCommand comm = newSqlCommand();
SqlDataAdapter dataAdapter = newSqlDataAdapter();
comm.CommandType = System.Data.CommandType.StoredProcedure;
comm =newSqlCommand(selectCommand, conn);
dataAdapter =newSqlDataAdapter(comm);
dataAdapter.Fill(datatable);
conn.Close();
return datatable;
}
this is how the connection is done would I need the conn.close() here or does the fill() method take care of that?
Debra has a question