Premesso che utilizzo la libreria SD_SQL
1- il mio database si chiama MultiServer (db sqlserver)
2- indirizzo ip dove collegarmi 192.168.1.15 (ip del server)
3- la mia Istanza e' SqlExpress
ed ecco il corpo del reato :
Dim MSSQL As SD_SQL
Private MSLocation As String = "192.168.1.15/MultiServer:1433;instanceName=sqlserver;databaseName=MultiServer;user=sa;password=piero;encrypt=true;trustServerCertificate=false;loginTimeout=30;"
Private MSUsername As String = "sa"
Private MSPassword As String = "pippo"
Wait For MSSQL_Ready(Success As Boolean)
If Success Then
Dim RS As SD_ResultSet = MSSQL.ExecQuery("SELECT * FROM tabella")
Do While RS.NextRow
Log(RS.GetString2(0))
Loop
End If
la variabile "Success" mi restituisce sempre "false"
Dim MSSQL As SD_SQL
Private MSLocation As String = "192.168.1.15/MultiServer:1433;loginTimeout=30;"
Private MSUsername As String = "sa"
Private MSPassword As String = "piero"
MSSQL.Initialize(Me,"MSSQL","net.sourceforge.jtds.jdbc.Driver", $"jdbc:jtds:sqlserver://${MSLocation}"$, MSUsername, MSPassword)
Wait For MSSQL_Ready(Success As Boolean)
If Success Then
Dim RS As SD_ResultSet = MSSQL.ExecQuery("SELECT * FROM PERSONALE")
Do While RS.NextRow
Log(RS.GetString2(0))
Loop
End If
Dim MSSQL As SD_SQL
Private MSLocation As String = "192.168.1.15"
Private MSUsername As String = "sa"
Private MSPassword As String = "piero"
MSSQL.Initialize(Me,"MSSQL","net.sourceforge.jtds.jdbc.Driver", $"jdbc:jtds:sqlserver://${MSLocation}/MultiServer"$, MSUsername, MSPassword)
Wait For MSSQL_Ready(Success As Boolean)
If Success Then
Dim RS As SD_ResultSet = MSSQL.ExecQuery("SELECT * FROM PERSONALE")
Do While RS.NextRow
Log(RS.GetString2(0))
Loop
End If
Dove ha scaricato la libreria ci sono i link per i file jar necessari.
(Interpreto il pensiero dell'autore della libreria che ha scritto il tutorial perchè sia letto )
Comunque se vai nel sorgente della libreria trovi anche gli eventi che solleva in caso di errore e puoi capire la ragione della mancata connessione.
Nei log cosa ti esce?