On 27 Jun 2004 20:03:14 -0700,
(Paul) wrote or
quoted :
>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();
>
You could have discovered some of the errors with JavaC or better
Jikes in pendant mode. See also
http://mindprod.com/jgloss/lint.html
The things that stand out for me is the violation of the caps
conventions. See
http://mindprod.com/jgloss/codingconventions.html
You are writing "string" for "String" which is not only a sylistic
error, but a syntax error as well.
--
Canadian Mind Products, Roedy Green.
Coaching, problem solving, economical contract programming.
See
http://mindprod.com/jgloss/jgloss.html for The Java Glossary.