Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Tuesday, November 26, 2024 
 
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 - ADO General
Forum to discuss ADO specific questions for use with SalesLogix. View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to ADO General | New ThreadView:  Search:  
 Author  Thread: An unknown or internal error has occurred.
Jason Lamb
Posts: 3
 
An unknown or internal error has occurred.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Mar 08 7:39 AM
I am writing code to sync changes in AD with contact records.
Three contacts are updated sucessfully, but the fourth UPDATE statement will generate an error in the cnnSLX object:
objError.Number: -2147211504
objError.Description: An unknown or internal error has occurred.
and returns an updated record count of -1

My connection string is:
Provider=SLXOLEDB.1;Integrated Security=""assword=Secretersist Security Info=True;User ID=Admin;Initial Catalog=SALESLOGIX;Data Source=BOSSQL1;Extended Properties="Port=1706;Log=On";Location="";Mode=ReadWrite

How can I troubleshoot what is going on...
I don't see the failed update statement in Profiler, so I am pretty sure that it is the SLX DB provider that is unhappy.

Thanks!
Jason
strSQL = "UPDATE CONTACT SET TYPE = ?, ACCOUNT = ?, DEPARTMENT = ?, LASTNAME = ?, FIRSTNAME = ?, WORKPHONE = ?, HOMEPHONE = ?, FAX = ?, " & _
"MOBILE = ?, EMAIL = ?, WEBADDRESS = ?, TITLE = ?, SECCODEID = ?, STATUS = ?, LASTNAME_UC = ?, USERFIELD1 = ? WHERE (CONTACTID = ?)"
Set cmdSLX = CreateObject("ADODB.Command")
cmdSLX.ActiveConnection = cnnSLX
cmdSLX.CommandType = adCmdText
cmdSLX.CommandText = strSQL

cmdSLX.Parameters.Refresh
For i = cmdSLX.Parameters.Count - 1 To 0 Step -1
cmdSLX.Parameters.Delete i
Next
cmdSLX.Parameters.Append cmdSLX.CreateParameter("TYPE", adVarChar, adParamInput, 64, "Internal Employee") 'isNullable=True
cmdSLX.Parameters.Append cmdSLX.CreateParameter("ACCOUNT", adVarChar, adParamInput, 128, strHouseAccountAccount) 'isNullable=True
cmdSLX.Parameters.Append cmdSLX.CreateParameter("DEPARTMENT", adVarChar, adParamInput, 32, objUser.department) 'isNullable=True
cmdSLX.Parameters.Append cmdSLX.CreateParameter("LASTNAME", adVarChar, adParamInput, 32, objUser.sn) 'isNullable=True
cmdSLX.Parameters.Append cmdSLX.CreateParameter("FIRSTNAME", adVarChar, adParamInput, 32, objUser.givenName) 'isNullable=True
cmdSLX.Parameters.Append cmdSLX.CreateParameter("WORKPHONE", adVarChar, adParamInput, 32, objUser.telephoneNumber) 'isNullable=True
cmdSLX.Parameters.Append cmdSLX.CreateParameter("HOMEPHONE", adVarChar, adParamInput, 32, objUser.homePhone) 'isNullable=True
cmdSLX.Parameters.Append cmdSLX.CreateParameter("FAX", adVarChar, adParamInput, 32, objUser.facsimileTelephoneNumber) 'isNullable=True
cmdSLX.Parameters.Append cmdSLX.CreateParameter("MOBILE", adVarChar, adParamInput, 32, objUser.mobile) 'isNullable=True
cmdSLX.Parameters.Append cmdSLX.CreateParameter("EMAIL", adVarChar, adParamInput, 128, objUser.mail) 'isNullable=True
cmdSLX.Parameters.Append cmdSLX.CreateParameter("WEBADDRESS", adVarChar, adParamInput, 128, objUser.wWWHomePage) 'isNullable=True
cmdSLX.Parameters.Append cmdSLX.CreateParameter("TITLE", adVarChar, adParamInput, 64, objUser.Title) 'isNullable=True
cmdSLX.Parameters.Append cmdSLX.CreateParameter("SECCODEID", adChar, adParamInput, 12, "SYST00000001") 'isNullable=False
cmdSLX.Parameters.Append cmdSLX.CreateParameter("STATUS", adVarChar, adParamInput, 64, "Active") 'isNullable=True
cmdSLX.Parameters.Append cmdSLX.CreateParameter("LASTNAME_UC", adVarChar, adParamInput, 32, UCase(objUser.sn)) 'isNullable=True
cmdSLX.Parameters.Append cmdSLX.CreateParameter("USERFIELD1", adVarChar, adParamInput, 80, objUser.GUID) 'isNullable=True
cmdSLX.Parameters.Append cmdSLX.CreateParameter("CONTACTID", adChar, adParamInput, 12, strContactID) 'isNullable=False


cnnSLX.Errors.Clear
cmdSLX.Execute i
For Each objError In cnnSLX.Errors
Debug.Print objError.Number & vbTab & objError.SqlState & vbTab & objError.Description
Next

Debug.Assert i = 1
Set cmdSLX = Nothing
[Reply][Quote]
Jason Lamb
Posts: 3
 
Re: An unknown or internal error has occurred.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Mar 08 3:45 PM
Ah... If you let me stew enough of this... I would figure it out.
Turns out that one of the strings that was being returned from AD objUser.department was longer then what is allowed in SLX.
The CreateParameter failed and returned Nothing.
So.. all of the parameters got shifted up.

What kind of error checking do YOU put in place to prevent this from happening?

Jason
[Reply][Quote]
Jason Lamb
Posts: 3
 
Re: An unknown or internal error has occurred.Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 21 Mar 08 8:40 AM
The code below is what I settled on.
That way if one of the CreateParameter fails it only affects that one field.
Also can check that I've added the same number of Parameters as the query expects.
Hope this helps someone.

strSQL = "INSERT INTO CONTACT (CONTACTID, TYPE, ACCOUNTID, ACCOUNT, DEPARTMENT, LASTNAME, FIRSTNAME, MIDDLENAME, ADDRESSID, SHIPPINGID, WORKPHONE, HOMEPHONE, FAX, MOBILE, EMAIL, WEBADDRESS, TITLE, SECCODEID, STATUS, LASTNAME_UC, USERFIELD1) " & _
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"

cmdSLX.CommandText = strSQL
i = -1
i = i + 1: cmdSLX.Parameters(i) = cmdSLX.CreateParameter("CONTACTID", adChar, adParamInput, 12, strContactID) 'isNullable=False
i = i + 1: cmdSLX.Parameters(i) = cmdSLX.CreateParameter("TYPE", adVarChar, adParamInput, 64, "Internal Employee") 'isNullable=True
i = i + 1: cmdSLX.Parameters(i) = cmdSLX.CreateParameter("ACCOUNTID", adChar, adParamInput, 12, strHouseAccountID) 'isNullable=True
i = i + 1: cmdSLX.Parameters(i) = cmdSLX.CreateParameter("ACCOUNT", adVarChar, adParamInput, 128, strHouseAccountAccount) 'isNullable=True
i = i + 1: cmdSLX.Parameters(i) = cmdSLX.CreateParameter("DEPARTMENT", adVarChar, adParamInput, 32, objUser.department) 'isNullable=True
i = i + 1: cmdSLX.Parameters(i) = cmdSLX.CreateParameter("LASTNAME", adVarChar, adParamInput, 32, objUser.sn) 'isNullable=True
i = i + 1: cmdSLX.Parameters(i) = cmdSLX.CreateParameter("FIRSTNAME", adVarChar, adParamInput, 32, objUser.givenName) 'isNullable=True
i = i + 1: cmdSLX.Parameters(i) = cmdSLX.CreateParameter("MIDDLENAME", adVarChar, adParamInput, 32, Null) 'isNullable=True
i = i + 1: cmdSLX.Parameters(i) = cmdSLX.CreateParameter("ADDRESSID", adChar, adParamInput, 12, strHouseAccountAddressID) 'isNullable=True
i = i + 1: cmdSLX.Parameters(i) = cmdSLX.CreateParameter("SHIPPINGID", adChar, adParamInput, 12, strHouseAccountShippingID) 'isNullable=True
i = i + 1: cmdSLX.Parameters(i) = cmdSLX.CreateParameter("WORKPHONE", adVarChar, adParamInput, 32, objUser.telephoneNumber) 'isNullable=True
i = i + 1: cmdSLX.Parameters(i) = cmdSLX.CreateParameter("HOMEPHONE", adVarChar, adParamInput, 32, objUser.homePhone) 'isNullable=True
i = i + 1: cmdSLX.Parameters(i) = cmdSLX.CreateParameter("FAX", adVarChar, adParamInput, 32, objUser.facsimileTelephoneNumber) 'isNullable=True
i = i + 1: cmdSLX.Parameters(i) = cmdSLX.CreateParameter("MOBILE", adVarChar, adParamInput, 32, objUser.mobile) 'isNullable=True
i = i + 1: cmdSLX.Parameters(i) = cmdSLX.CreateParameter("EMAIL", adVarChar, adParamInput, 128, objUser.mail) 'isNullable=True
i = i + 1: cmdSLX.Parameters(i) = cmdSLX.CreateParameter("WEBADDRESS", adVarChar, adParamInput, 128, objUser.wWWHomePage) 'isNullable=True
i = i + 1: cmdSLX.Parameters(i) = cmdSLX.CreateParameter("TITLE", adVarChar, adParamInput, 64, objUser.Title) 'isNullable=True
i = i + 1: cmdSLX.Parameters(i) = cmdSLX.CreateParameter("SECCODEID", adChar, adParamInput, 12, "SYST00000001") 'isNullable=False
i = i + 1: cmdSLX.Parameters(i) = cmdSLX.CreateParameter("STATUS", adVarChar, adParamInput, 64, "Active") 'isNullable=True
i = i + 1: cmdSLX.Parameters(i) = cmdSLX.CreateParameter("LASTNAME_UC", adVarChar, adParamInput, 32, UCase(objUser.sn)) 'isNullable=True
i = i + 1: cmdSLX.Parameters(i) = cmdSLX.CreateParameter("USERFIELD1", adVarChar, adParamInput, 80, objUser.GUID) 'isNullable=True
Debug.Assert i = cmdSLX.Parameters.Count - 1
cmdSLX.Execute i
Debug.Assert i = 1

[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 © 2024 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): 11/26/2024 4:01:15 AM