Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Thursday, May 9, 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!
 External Development Forums - General External Development
Forum to discuss general external development topic (related or not to SalesLogix development). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to General External Development | New ThreadView:  Search:  
 Author  Thread: Insert Statement..???
RJ Eaton
Posts: 234
 
Insert Statement..???Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Oct 07 10:04 AM
Everyone, Seems I am having a bit of difficulty with an insert statement that I have been looking at for last 3 hours... Here is what I am doing:

1. Create Array from thing I want to insert into product table...

Try to run single insert statement for each item in the array.. however it seems to not parse my SQL statement through the provider..

============== CODE ================

Dim alProduct As New ArrayList

For Each dr As DataRow In oUpdateSLX.SLX_ExecuteQuery(sSQL).Rows
Dim oProducts As New Product_Data
With oProducts
.ProductId = CreateSlxID("Product", 1)
.ActualId = NullToBlank(dr("FundId"))
.Description = NullToBlank(dr("FundName"))
.Family = NullToBlank(dr("AssetClass"))
.Name = NullToBlank(dr("FundName"))
.Price = 1
.Program = "Fund"
.Status = NullToBlank(dr("Status"))
.Type = NullToBlank(dr("FundType"))
End With
alProduct.Add(oProducts)
Next

Stop

Dim sNew As Integer = alProduct.Count 'used for count of new funds added
Dim oSLXUpdate As SLX_Connection

Try
oSLXUpdate = New SLX_Connection(SLXConn)
Catch ex As Exception

End Try

For Each oProduct As Product_Data In alProduct

'Update Product Table
sSQL = "Insert Into Product('ProductId', 'ActualId', 'Name', 'Type', 'Family', 'Description', 'Price', 'Program', 'Status') Values(oProduct.ProductId, oProduct.ActualId, " & _
"oProduct.Name, oProduct.Type, oProduct.Family, oProduct.Description, oProduct.Price, oProduct.Program, oProduct.Status)"

oSLXUpdate.SLX_ExecuteScalar(sSQL)


=================== END of CODE ===============

Any other eyes can see what I am missing..?
[Reply][Quote]
RJ Eaton
Posts: 234
 
Re: Insert Statement..???Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 23 Oct 07 12:24 PM
Ok SO my SQl statement was bad.. see a short wak away and presto.... here is the error correction in cse anyone cares..

sSQL = "Insert Into Product(ProductId, ActualId, Name, Type, Family, Description, Price, Program, Status) " & _
"Values('" & oProduct.ProductId & "','" & oProduct.ActualId & "','" & oProduct.Name & "','" & _
oProduct.Type & "','" & oProduct.Family & "','" & oProduct.Description & "','" & oProduct.Price & "','" & _
oProduct.Program & "','" & oProduct.Status & "')"
[Reply][Quote]
John Gundrum
Posts: 632
Top 10 forum poster: 632 posts
 
Re: Insert Statement..???Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 26 Oct 07 7:30 AM
I am always leary of arrays because of the memory requirements. I've always seen apps that use them all of a sudden break because an array was used.

I tend toward using cursors instead.

John G.
[Reply][Quote]
Bob (RJ)Ledger
Posts: 1103
Top 10 forum poster: 1103 posts
 
Re: Insert Statement..???Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 27 Oct 07 8:37 AM
RJ, Side note....
I see this is all about "Product". There's a handy generic Product Import tool that I wrote a while ago (NO Inserts.. all ADO Recordset).. on this site. You might want to look at that too.

http://www.slxdeveloper.com/page.aspx?action=viewarticle&articleid=69

--
rjl
[Reply][Quote]
John Gundrum
Posts: 632
Top 10 forum poster: 632 posts
 
Re: Insert Statement..???Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 29 Oct 07 9:51 AM
http://www.slxdeveloper.com/page.aspx?action=viewarticle&articleid=69

Will this bundle work for 7.x as well?

John G.
[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): 5/9/2024 1:57:06 AM