Hi there,
I have a small app (Windows) to test a MSSQL Express connection.
MSSQL (SQL Server 2008 R2 10.50.4000) runs on a XP sp3 machine
Xojo 2013r3.1 IDE installed on both Win7 and XP machine, gives the same error on both OS
The following code can connect to the database but crashes on SQLExecute
No error in debugger, just XP crash with this error: “AppName: debugmon application.exe AppVer: 1.0.0.0 ModName: mssqlserverplugin.dll
ModVer: 0.0.0.0 Offset: 00011876”
Code to connect to SQL database: no problem here
[code] mDb = New MSSQLServerDatabase
mDb.Host = “192.168.1.102”
mDb.UserName = “xxxx”
mDb.Password = “xxxx”
mDb.DatabaseName = “DXDB”
If mDb.Connect Then
mIsConnected = True
ConnectStatusLabel.Text = “Connected to MS SQL Server”
Else
mIsConnected = False
ConnectStatusLabel.Text = "Error connecting to MS SQL Server: " + mDb.ErrorMessage
End If[/code]
Method to load database records in a ListBox - crash on stmt.SQLExecute:
Method is “loadAccounts(name As String)” crashes when name is “” or not “”
[code] DataList.DeleteAllRows
Dim sql As String
Dim stmt As MSSQLServerPreparedStatement
if name <> “” Then
stmt = mDB.Prepare("SELECT * FROM _Accounts WHERE acctName LIKE ? ")
stmt.BindType(0, MSSQLServerPreparedStatement.MSSQLSERVER_TYPE_STRING)
stmt.Bind(0, “%” + name + “%”)
else
stmt = mDB.Prepare(“SELECT * FROM _Accounts”)
End If
stmt.SQLExecute
Dim data As RecordSet = stmt.SQLSelect
If mDB.Error Then
MsgBox("DB Error: " + mDB.ErrorMessage)
Return
End If
If data <> Nil Then
While Not data.EOF
DataList.AddRow(data.Field(“acctCode”).StringValue, data.Field(“acctName”).StringValue, _
data.Field(“City”).StringValue)
data.MoveNext
Wend
data.Close
End If
[/code]
Any help welcome !
Thanks