MSSQL - Brain Fail!

Hi

This is a simple test app for XDC and having a complete brain fail on the attached code. When the code runs the SQLSelect the app just dies with a DebugMyApplication.exe has stopped working error and I have no choice but to kill the program. It doesn’t get to the rs <> nil check, under the variables list the ps prepared statement seems empty?

This is running Xojo 2014r1 with latest MSSQL plugin and on a Windows 7 64 bit VM under Parallels. I’m claiming Friday afternoon syndrome but I can’t see what I’ve done! Any ideas?

Great - the forum isn’t letting me post the picture! Here’s the code

[code]Dim db As New MSSQLServerDatabase

db.Host = “WIN-7-64BIT-VM”
db.DatabaseName = “AdventureWorks2008R2”
db.UserName = “xdcuser”
db.Password = “xdcuser”

If db.Connect Then
Dim ps As MSSQLServerPreparedStatement
ps = db.Prepare(“EXECUTE [dbo].[RetrieveXML] ?”)

ps.BindType(0, MSSQLServerPreparedStatement.MSSQLSERVER_TYPE_INT)
ps.Bind(0, Val(txtBusinessEntityId.Text))

Dim rs As RecordSet = ps.SQLSelect

If rs <> Nil Then
  While Not rs.EOF
    taXML.Text = rs.IdxField(1).StringValue
    rs.MoveNext
  Wend
  rs.Close
else
  break
End If

Else
MsgBox(“Connection error:” + db.ErrorMessage)
End If[/code]

[quote=71391:@Patrick Delaney]This is running Xojo 2014r1 with latest MSSQL plugin and on a Windows 7 64 bit VM under Parallels. I’m claiming Friday afternoon syndrome but I can’t see what I’ve done! Any ideas?
[/quote]

Any chance it works with an earlier Xojo and you’ve stumbled on a regression?

Have you tried checking db.ErrorMessage after

Dim rs As RecordSet = ps.SQLSelect

[quote=71407:@Johnny Harris]Have you tried checking db.ErrorMessage after

Dim rs As RecordSet = ps.SQLSelect[/quote]

doesn’t get that far - just crashes on the SQLSelect statement - doesn’t run anything after the statement.

Brad - good idea - I’ll try that…

This sounds like a bug we already fixed, but it was too late to include in 2014r1:
<https://xojo.com/issue/32119>

doesn’t work in 2013 r4.1

[quote=71412:@William Yu]This sounds like a bug we already fixed, but it was too late to include in 2014r1:
<https://xojo.com/issue/32119>[/quote]

■■■■■■ - forgot about that one! Explains why I couldn’t work out why it was crashing! I’ll revert to a non-preparedstatement for this as part of the presentation. It’s a stored procedure so it’ll reenforce an earlier message I make in the presentation. Thanks William.

Yep - this is indeed the issue…