11/22/2024 1:56:33 PM
|
|
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!
Forum to discuss general external development topic (related or not to SalesLogix development). View the code of conduct for posting guidelines.
|
|
|
|
Insert Statement..???
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..? |
|
|
|
Re: Insert Statement..???
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 & "')" |
|
|
|
Re: Insert Statement..???
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. |
|
|
| |
| |
|
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!
|
|
|
|
|
|
|
|