'Declaration Public Overloads Shadows Function ExecuteReader() As MySqlDataReader
public new MySqlDataReader ExecuteReader()
Return Value
A MySqlDataReader object.
'Declaration Public Overloads Shadows Function ExecuteReader() As MySqlDataReader
public new MySqlDataReader ExecuteReader()
When FetchAll property is false the following restriction takes place. While the MySqlDataReader is in use, the associated MySqlConnection is busy serving the MySqlDataReader. While in this state, no operations can be performed on the MySqlConnection except closing. This is the case until the Close() method of the MySqlDataReader is called.
public void CreateMySqlDataReader(string mySelectQuery,string myConnectionString) { MySqlConnection myConnection = new MySqlConnection(myConnectionString); MySqlCommand myCommand = new MySqlCommand(mySelectQuery, myConnection); myCommand.Connection.Open(); MySqlDataReader myReader = myCommand.ExecuteReader(); try { while(myReader.Read()) { Console.WriteLine(myReader.GetString(0)); } } finally { myReader.Close(); myConnection.Close(); } }
Public Sub CreateMySqlDataReader(mySelectQuery As String, _ myConnectionString As String) Dim myConnection As New MySqlConnection(myConnectionString) Dim myCommand As New MySqlCommand(mySelectQuery, myConnection) myCommand.Connection.Open() Dim myReader As MySqlDataReader = myCommand.ExecuteReader() Try While myReader.Read() Console.WriteLine(myReader.GetString(0)) End While Finally myReader.Close() myConnection.Close() End Try End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2