Ciao a tutti,
ho bisogno di leggere un dato da una query sql in VB.net .
Io ho il seguente codice:
Dim stringasql, prova As String
Dim SQLConn As New SqlConnection("Data Source=;Initial Catalog=;User Id=;Password=;")
Dim SQLCmd As New SqlCommand()
Dim SQLdr As SqlDataReader
stringasql = "SELECT tipo FROM Utenti WHERE [user]='" & Me.Text_User.Text & "'"
SQLConn.Open()
SQLCmd.Connection = SQLConn
SQLCmd.CommandText = stringasql
SQLCmd.ExecuteNonQuery()
SQLdr = SQLCmd.ExecuteReader
prova = SQLdr.ToString
SQLConn.Close() 'Close the connection
Io devo mettere il mio risultato in prova, ma non capisco come fare a leggere il mio dato.
Scusate.
Grazie in anticipo