For example, the following code works fine without SqlConnection.
Any Answer to the question?
string connectionString =
"server=YourServer; uid=sa;
pwd=YourPassword; database=ProgASPDotNetBugs";
// get records from the Bugs table
string commandString =
"Select BugID, Description from Bugs";
// create the dataset command object
// and the DataSet
SqlDataAdapter dataAdapter =
new SqlDataAdapter(
commandString, connectionString);
DataSet dataSet = new DataSet();
// fill the dataset object
dataAdapter.Fill(dataSet,"Bugs");
// Get the one table from the DataSet
DataTable dataTable = dataSet.Tables[0];
// for each row in the table, display the info
foreach (DataRow dataRow in dataTable.Rows)
{
lbBugs.Items.Add(
dataRow["BugID"] +
": " + dataRow["Description"] );
}