Salve a tutti.
Ho dichiarato un metodo in una mia classe che si occupa di gestire un Reader ( mysqldatareader )
Il metodo della classe è il seguente
codice:
Public Sub Lettore(ByRef Lettore As MySqlDataReader, ByVal StringaSQL As String)
ConnessioneSQL("localhost", "root", "**", "**")
Try
_CMD.CommandText = StringaSQL
_CMD.Connection = _Connessione
Lettore = _CMD.ExecuteReader
Catch ex As Exception
Lettore = Nothing
End Try
End Sub
e il modo in cui lo richiamo è questo qui
codice:
If Form1.ModificaAttiva = True Then
Dim SQLString As String
SQLString = "SELECT Nome, Cognome, Telefono FROM tabella WHERE IDCliente = '" & Form1.RowIndex & "'"
Dim ManagerSQL As New clsSQL
Dim Lettore As MySqlDataReader
ManagerSQL.Lettore(Lettore, SQLString)
While Lettore.Read()
TXTnome.Text = Lettore.GetString(0)
End While
Lettore.Close()
FRMElencoClienti.ModificaAttiva = False
End If
Come mai mi da una null reference qui
codice:
While Lettore.Read()
Dicendomi che devo stanziare l'oggetto ?
Grazie a tutti.
Buona Giornata