Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, August 29, 2025 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Architect Forums - SalesLogix Scripting & Customization
Forum to discuss writing script in Architect plugins for SalesLogix & general SalesLogix customization topics (for Windows client only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Scripting & Customization | New ThreadView:  Search:  
 Author  Thread: Outlook Crashes running DB Query to SLX
thepip3r
Posts: 16
 
Outlook Crashes running DB Query to SLXYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Aug 09 5:11 PM
When using this code in a macro:

Sub SLX_Test()

Set objConn = CreateObject("ADODB.Connection")
Set objRS = CreateObject("ADODB.Recordset")

objConn.ConnectionString = "Provider=SLXOLEDB.1;Integrated Security=True;Initial Catalog=SLX_DB;Data Source=slx_server;Extended Properties=PORT=1706;LOG=ON;Location=;Mode=ReadWrite"
objConn.Open

strTicketNumber = "25582"

strSQL = "SELECT TOP 1 C.LASTNAME,C.FIRSTNAME,C.EMAIL,A.INTERNALACCOUNTNO,A.ACCOUNT FROM sysdba.TICKET T, sysdba.CONTACT C, sysdba.ACCOUNT A WHERE T.CONTACTID = C.CONTACTID AND T.ACCOUNTID = A.ACCOUNTID AND T.ALTERNATEKEYSUFFIX = '025582'"
objRS.Open strSQL, objConn, 3, 3

While Not objRS.EOF
'strCustomerName = objRS("FIRSTNAME") & " " & objRS("LASTNAME")
'strCustomerEmail = objRS("EMAIL")
'strAccountID = objRS("INTERNALACCOUNTNO")
'strAccountName = objRS("ACCOUNT")
'MsgBox strCustomerName & " " & strCustomerEmail & " " & strAccountID & " " & strAccountName
MsgBox objRS("EMAIL")
objRS.MoveNext
Wend
objRS.Close

objConn.Close
Set objRS = Nothing
Set objConn = Nothing
End Sub

...Outlook crashes. Like, actually pops up the message to send the crash report to Microsoft. When I hit details, it tells me that it crashed due to an SLX DLL. If I change strSQL to something simple like: SELECT TOP 1 * FROM sysdba.TICKET WHERE ALTERNATEKEYSUFFIX = '025582', the code works fine and my messagebox returns any valid column from the table i want.

i've also tested the above query to the same SLX database in ADO Explorer and it runs fine and returns the appropriate columns. Any suggestions?
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Outlook Crashes running DB Query to SLXYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Aug 09 6:53 PM
If Outlook is crashing that is most likely due to an error occurring in the code somewhere (nothing pops out at me). Add in some error checking to see what might be going on. A simple route would be to add this to the top of the code:

On Error Resume Next

and then at the end add this:

If Err.Number <> 0 Then
MsgBox Err.Description
End If

Give that a try to see what turns up.

-Ryan
[Reply][Quote]
thepip3r
Posts: 16
 
Re: Outlook Crashes running DB Query to SLXYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Aug 09 6:58 PM
Added, error checking and i don't get any message boxes, Outlook still crashes. Would vbscript error checking catch an Outlook crash anyways? Wouldn't this only catch errors in my code? ..like normal ones that would throw a message box stating some error number instead of actually crashing my application? sorry, i'm a noob! =P

also, i got around this anyways by running 3 separate queries instead of the join but would still be interested in finding out what happened here. thanx for the assistance Ryan.
[Reply][Quote]
Ryan Farley
Posts: 2265
slxdeveloper.com Site Administrator
Top 10 forum poster: 2265 posts
 
Re: Outlook Crashes running DB Query to SLXYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Aug 09 7:23 PM
Correct, the error checking will only catch errors in your code, but that *is* where the error is coming from. It might be thrown from a SLX DLL, but it is your use of that DLL, via the SLX OLEDB Provider, that is causing it - and this would/should be caught in the error checking.

Anyway, my guess that that there was a problem with the query. The SLX Provider doesn't care for cross-joins (such as select fields from table1, table2 where...). Insead use explicit joins, such as select fields from table1 left join table2 on table1.someid = table2.someid etc.

Since the change in query got rid of the error that was probably it.
[Reply][Quote]
thepip3r
Posts: 16
 
Re: Outlook Crashes running DB Query to SLXYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Aug 09 10:04 AM
Sub SLX_Test()
On Error Resume Next

Set objConn = CreateObject("ADODB.Connection")
Set objRS = CreateObject("ADODB.Recordset")

objConn.ConnectionString = "Provider=SLXOLEDB.1;Integrated Security=True;Initial Catalog=SLXSUPPORT;Data Source=slx;Extended Properties=PORT=1706;LOG=ON;Location=;Mode=ReadWrite"
objConn.Open

strTicketNumber = "25582"

strSQL = "SELECT TOP 1 C.LASTNAME,C.FIRSTNAME,C.EMAIL,A.INTERNALACCOUNTNO,A.ACCOUNT FROM sysdba.TICKET T, sysdba.CONTACT C, sysdba.ACCOUNT A WHERE T.CONTACTID = C.CONTACTID AND T.ACCOUNTID = A.ACCOUNTID AND T.ALTERNATEKEYSUFFIX = '025582'"
objRS.Open strSQL, objConn, 3, 3
If Err.Number <> 0 Then
MsgBox Err.Description
End If

While Not objRS.EOF
If Err.Number <> 0 Then
MsgBox Err.Description
End If
'strCustomerName = objRS("FIRSTNAME") & " " & objRS("LASTNAME")
'strCustomerEmail = objRS("EMAIL")
'strAccountID = objRS("INTERNALACCOUNTNO")
'strAccountName = objRS("ACCOUNT")
'MsgBox strCustomerName & " " & strCustomerEmail & " " & strAccountID & " " & strAccountName
MsgBox objRS("AREA2")
objRS.MoveNext
If Err.Number <> 0 Then
MsgBox Err.Description
End If
Wend
objRS.Close

objConn.Close
Set objRS = Nothing
Set objConn = Nothing
End Sub

Still crashes. I guess it might be the cross-join but ADO Explorer using the SLX provider pulls back the resultset exactly as desired. regardless, i'll try it with inner,left,right joins and see how that works.
[Reply][Quote]
thepip3r
Posts: 16
 
Re: Outlook Crashes running DB Query to SLXYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Aug 09 10:12 AM
Thanks Ryan. It appears it was simply the SLX DLL's disagreement with the type of join. I rebuilt the query using inner joins and it works like a champ. Thanks for the advice.

Sub SLX_Test()

Set objConn = CreateObject("ADODB.Connection")
Set objRS = CreateObject("ADODB.Recordset")

objConn.ConnectionString = "Provider=SLXOLEDB.1;Integrated Security=True;Initial Catalog=SLXSUPPORT;Data Source=slx;Extended Properties=PORT=1706;LOG=ON;Location=;Mode=ReadWrite"
objConn.Open

strTicketNumber = "25582"

strSQL = "SELECT TOP 1 C.LASTNAME,C.FIRSTNAME,C.EMAIL,A.INTERNALACCOUNTNO,A.ACCOUNT FROM sysdba.TICKET T " & _
"JOIN sysdba.CONTACT C ON T.CONTACTID = C.CONTACTID" & _
"JOIN sysdba.ACCOUNT A ON T.ACCOUNTID = A.ACCOUNTID" & _
"WHERE T.ALTERNATEKEYSUFFIX = '025582'"

objRS.Open strSQL, objConn, 3, 3

While Not objRS.EOF
'strCustomerName = objRS("FIRSTNAME") & " " & objRS("LASTNAME")
'strCustomerEmail = objRS("EMAIL")
'strAccountID = objRS("INTERNALACCOUNTNO")
'strAccountName = objRS("ACCOUNT")
'MsgBox strCustomerName & " " & strCustomerEmail & " " & strAccountID & " " & strAccountName
MsgBox objRS("AREA2")
objRS.MoveNext
Wend
objRS.Close

objConn.Close
Set objRS = Nothing
Set objConn = Nothing
End Sub
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2025 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 8/29/2025 3:00:25 PM