'Declaration Public Shadows ReadOnly Property ServerVersion As String
public new string ServerVersion {get;}
'Declaration Public Shadows ReadOnly Property ServerVersion As String
public new string ServerVersion {get;}
public void GetMyData(string myConnectionString) { MySqlConnection myConn = new MySqlConnection(myConnectionString); string mySelectQuery = "SELECT * FROM Test.Dept"; MySqlCommand myCommand = new MySqlCommand(mySelectQuery); myCommand.Connection = myConn; myConn.Open(); if (string.Compare(myConn.ClientVersion,"4.1")>=0 & string.Compare(myConn.ServerVersion,"4.1")>=0) { myCommand.Prepare(); } try { MySqlDataReader myReader = myCommand.ExecuteReader(); ... myReader.Close(); } finally { myConn.Close(); } }
Public Sub GetMyData(ByVal myConnectionString As String) Dim myConn As MySqlConnection = New MySqlConnection(myConnectionString) Dim mySelectQuery As String = "SELECT * FROM Test.Dept" Dim myCommand As MySqlCommand = New MySqlCommand(mySelectQuery) myCommand.Connection = myConn myConn.Open() Dim Client_OK As Boolean = String.Compare(myConn.ClientVersion, "4.1") >= 0 Dim Server_OK As Boolean = String.Compare(myConn.ServerVersion, "4.1") >= 0 If Client_OK And Server_OK Then myCommand.Prepare() End If Try Dim myReader As MySqlDataReader = myCommand.ExecuteReader() ... myReader.Close() Finally myConn.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