Il linguaggio è il VB net.
Di seguito il codice
codice:
Dim DTNews As DataTable = ApriTab("Sintassi query")
If DTNews.Rows.Count > 0 Then
end if
"Apritab" è una funzione. Di seguito il codice
codice:
Public Function ApriTab(ByVal cQuery As String, Optional ByVal SingleValue As Boolean = False) As Object
Dim valRet As Object
Try
Dim cnClosed As Boolean = False
If cn.State = ConnectionState.Closed Then cn.Open()
Dim da As New MySqlDataAdapter(cQuery, cn)
Dim ds As New DataTable
da.Fill(ds)
da.Dispose()
If SingleValue And ds.Columns.Count = 1 Then 'singolo campo
valRet = ""
If ds.Rows.Count > 0 Then valRet = ds.Rows(0).Item(0)
Else 'DATASET di dati
If Not IsNothing(ds) Then valRet = ds Else Throw New DivideByZeroException("dataset nullo in Apritab")
End If
Catch ex As MySqlException
Catch ex As Exception
Threading.Thread.Sleep(200)
End Try
Return valRet
End Function