P
Paul
Considering all aspects like style, naming conventions, logic etc...
Is this code OK? Please comment...
public void ReadMyData(string myConnString)
{
string mySelectQuery = "SELECT OrderID, Customer FROM Orders";
SqlConnection myConnection = new SqlConnection(myConnString);
SqlCommand myCommand = new SqlCommand(mySelectQuery,myConnection);
myConnection.Open();
SqlDataReader myReader = myCommand.ExecuteReader();
while (myReader.Read())
{
Console.WriteLine(myReader.GetInt32(0) + ", " + myReader.GetString(1));
}
myReader.Close();
myConnection.Close();
}
Thanks,
Paul.
Is this code OK? Please comment...
public void ReadMyData(string myConnString)
{
string mySelectQuery = "SELECT OrderID, Customer FROM Orders";
SqlConnection myConnection = new SqlConnection(myConnString);
SqlCommand myCommand = new SqlCommand(mySelectQuery,myConnection);
myConnection.Open();
SqlDataReader myReader = myCommand.ExecuteReader();
while (myReader.Read())
{
Console.WriteLine(myReader.GetInt32(0) + ", " + myReader.GetString(1));
}
myReader.Close();
myConnection.Close();
}
Thanks,
Paul.