��������

����������������������������

C# ��MySQLDataReader������
��������������HasRows����������������������������
��������������������������

������������������������������
.NET��������DataTable����������������������������
DataTable.Rows.Count����������������

������
��������������������������������������������

������
������������������������


����
FieldsCount����������������������������������������


(2013/05/20 15:08), �������� wrote:
����������

������������������������������

������������������FieldCount��������MySQLDataReader����������������������������������
��������������������myReader.FieldCount����������������������������������





2013��5��20�� 14:35 ���������� <iwasaki_ryuqseed_6130@yahoo.co.jp>:
����������
 
����������������������������
 
��������C API��SQL����������������������
������C# + MySQL Connector/NET������������������
����������������������
 
��������������������������������������������������
������������������������������
 
����������������������������������������������������
������������������������������������
 
C API����mysql_num_rows()������������������������������
MySQL Connector/NET������������������������������������������
 
����������������������������������
 
��������������������������������������������������������
"SELECT COUNT(*) ..."��������������������������������
 
 
    string mySelectQuery = "SELECT OrderID, CustomerID FROM Orders";
    MySqlConnection myConnection = new MySqlConnection(myConnString);
    MySqlCommand myCommand = new MySqlCommand(mySelectQuery,myConnection);
    myConnection.Open();
    MySqlDataReader myReader;
    myReader = myCommand.ExecuteReader();
    // Always call Read before accessing data.
    while (myReader.Read()) {
       Console.WriteLine(myReader.GetInt32(0) + ", " + myReader.GetString(1));
    }
    // always call Close when done reading.
    myReader.Close();
    // Close the connection when done with it.
    myConnection.Close();
 
��������
Windows7��641bit
MySQL Connector/NET 6.6.5
Visual C#2012





--
http://about.me/touchan