MSSSQL crashes on SQLSelect

Good point Christian

Sascha - the code I’ve sent you uses SQLConnectionMBS class which, correct me if I’m wrong Christian,

  • Offers more flexibility than SQLDatabaseMBS
  • Means you don’t need a Xojo Database license

[quote=66672:@Christian Schmitz]If you have questions for MBS Plugin, you can email me directly.
With SQLDatabaseMBS the move to our plugin may only need a few lines changes.[/quote]

Thank you Christian and Patrick for your kind help.
Patricks code example and Christians Plugins working flawlessly!

I am used to use RecordSets and the AsRecordSet functionality of Christians Plugin is a perfect solution.

THANKY OU BOTH SO MUCH :slight_smile:

[code] WaWi_DB_MBS = New SQLDatabaseMBS // Needed for my RecordSet
dim con as new SQLConnectionMBS
dim com as new SQLCommandMBS

try
con.Option(“OLEDBProvider”) = “SQLNCLI10” // connect to database
con.Connect(“192.168.98.31@SL_M”, myLogin, myPassword, SQLConnectionMBS.kSQLServerClient)

// Set the details of the command to execute(and run it!)
com.Connection = con // Connection to use
com.setCommandText ("SELECT DEB.CRM_AdressenID, CRM.* FROM dbo.DEBITOREN AS DEB INNER JOIN dbo.CRM_ADRESSEN AS CRM ON DEB.CRM_AdressenID=CRM.ID WHERE DEB.Nummer='" + Kunde + "'", 0)

com.Execute // Run the command!

Dim rs As RecordSet = com.AsRecordSet
If rs <> Nil And Not rs.EOF Then
  // YES !!!!
  // FINALLY !!!
  // Enough now Sascha... go on with your work! ;-)
End If

con.Disconnect // Close The Connection

catch r as SQLErrorExceptionMBS
//Error Handling
MsgBox r.message
end try[/code]

Glad to help :slight_smile:

well, you could of course use the SQLDatabaseMBS class which is subclass of Database class. This way you have less code to change.

[quote=66672:@Christian Schmitz]If you have questions for MBS Plugin, you can email me directly.
With SQLDatabaseMBS the move to our plugin may only need a few lines changes.[/quote]

Hi Christian i’ve sent you a mail in the morning about SQLSelectAsRecordSet

Thanks