Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Monday, November 25, 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: Access 2000 - insert using OLEDB connection?
Jill D
Posts: 31
 
Access 2000 - insert using OLEDB connection?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 18 Nov 09 12:54 PM
Hello,

Does anyone have a working mod to insert a record from MS Access 2000 via SLX OLEBD for an onclick event? We cannot get the correct syntax to compile even a very simple script. Not sure if we are missing references?

The Access project is connected to SLX(7.2) database (SQL 2005) for this specific event we need to use the SLX provider to insert a record (to auto increment table ID). Thought it would be simple (we do inserts all the time) but...

thanks!

j
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: Access 2000 - insert using OLEDB connection?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Nov 09 3:07 AM
What is the error message that you are receiving?
Are you writing a SECCODEID value with the record (This is a required field, and will generate an Error if not populated).
Did you turn the AUTOINCREMENT for the Contact table on the CONTACTID field (this is not done out of the box, you need to do it yourself).

As far as writing data with AUTOINCREMENT turned on:

Dim aRec
Set aRec = CreateObject("ADODB.Recordset")
aRec.CursorType = 3
aRec.CursorLocation = 3
aRec.LockType = 3

'I am assuming that aCon is a connection object initialized with an SLXOLEDB connection string and that has already been opened.
aRec.Open "SELECT * FROM CONTACT WHERE 1 = 2", aCon
aRec.AddNew
aRec("SECCODEID") = "SYST00000001" 'defaulting to Everyone.
aRec("FIRSTNAME") = "Jon"
aRec("LASTNAME") = "Doe"
aRec.Update
Set aRec = Nothing

[Reply][Quote]
Jill D
Posts: 31
 
Re: Access 2000 - insert using OLEDB connection?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Nov 09 12:21 PM
Hi Raul!
Thanks for getting back to us. We are updating the History table only. Does SECCODEID need to be defined even if it isn't a field in that table? Autoincrement is enabled. We are getting an out of memory message after major hang time. The code compiles in ACCESS without an error. Test code below.

Private Sub Command5_Click()

Dim cn As ADODB.Connection, rs As ADODB.Recordset
Set cn = New ADODB.Connection

cn.Open "Provider=SLXOLEDB.1assword=ersist Security Info=True;User ID=;Initial Catalog=Test_Database;Data Source=SLX;Extended Properties=PORT=1706;LOG=ON;"

Set rs = New ADODB.Recordset
rs.CursorType = 3
rs.CursorLocation = 3
rs.LockType = 3

rs.Open "HISTORY", cn
rs.AddNew
rs("TYPE") = 262148
rs("ACCOUNTID") = "A6EKNA000GQZ"
rs("CONTACTID") = "C6EKNA00146K"
rs("ACCOUNTNAME") = "Test Account"
rs("CONTACTNAME") = "Name"
rs("CATEGORY") = "Collections"
rs("STARTDATE") = Now()
rs("DURATION") = 0
rs("DESCRIPTION") = "Verify Sent"
rs("USERID") = "U6EKNA000023"
rs("USERNAME") = "Name"
rs("ORIGINALDATE") = Now()
rs("RESULT") = "Complete"
rs("CREATEDATE") = Now()
rs("CREATEUSER") = "U6EKNA000023"
rs("MODIFYDATE") = Now()
rs("MODIFYUSER") = "U6EKNA000023"
rs("NOTES") = "List sent to Customer"
rs("LONGNOTES") = "List sent to Customer - Long Long Long Long Long Long Long Long Notes"

rs.Update
rs.Close 'Close record
cn.Close 'Close connection

End Sub
[Reply][Quote]
Raul A. Chavez
Posts: 1300
Top 10 forum poster: 1300 posts
 
Re: Access 2000 - insert using OLEDB connection?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 19 Nov 09 12:38 PM
Once I looked at your code, the problem is quite obvious (Keep reading for Solution).

I am not sure where I got CONTACT out of, shouldn't reply that early in the AM. But if you notice on my example, when I opened the recordset I used a well known trick to avoid the exact problem you are having.


The problem does not lie with SLX, the OLEDB Provider or the Auto Increment.
What is happenning is that you are attempting to load the whole History table into a Client Side recordset, thus the Out of Memory error after a while.

rs.Open "History", cn <<< This is a NO NO for any application, specially if using Client Site Recordsets. You are telling it to retreive the full history table.


Instead, follow my example and open an empty recordset:

rs.Open "SELECT * FROM HISTORY WHERE 1 = 2", cn


[Reply][Quote]
Jill D
Posts: 31
 
Re: Access 2000 - insert using OLEDB connection?Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 20 Nov 09 2:19 PM
Thanks Raul!

It's working like a charm!

j.
[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/25/2024 8:13:43 PM