Web with OBDC on Windows Server 2012 crash

XOJO 2018 r4

I need help
this is my code on windows server 2012 my web app when get to this point it crash if any idea way


Session.QbConn=New ODBCDatabase
// Cooling Systems
Session.QbConn.DataSource = “CData-HW”

If Session.QbConn.Connect Then
MsgBox("Error: " + Session.QbConn.ErrorMessage + " " + “(>>>QuickBooks is not Open <<<)”)
End If
Catch e As NilObjectException
MsgBox e.Message
end try

Does your data source (DSN) exist for the username running the web program? If you created a user DSN then probably not, try a system DSN.

Is your sample code in the Session.Open event? If not try placing it there.

What does the browser show when this happens?

yes DSN is create but no on System and the browser is on my app is running local on the server

A DSN can be created for a single user, or the system (for all users.) If its not a system DSN then it will work for you only. But the app is probably running under a different user so the DSN does not exist for it. I think you need to create a system DSN.

I looked at some of my code … I’m not sure you’re using .DataSource properly. Try it this way (not using DSN):

db = New ODBCDatabase db.DataSource = "Driver={SQL Server};Server=MyServer;Database=MyDB;" db.UserName = "xx" db.Password = "yy" db.Connect

If your database is MS SQL Server, you may need Server=MyServer\InstanceName in the data source.

thanks is working with system DSN