A good Forum for VB Help with data adapters and datasets?


Author
Message
Terry Bottorff
Terry Bottorff
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 448, Visits: 12K
This is really not a Strataframe issue. I am trying to save values from an array to a database table. I am not sure if I can use a BO or not but I was trying to write it on my own. I can get it to save one value from the array but not more? If anyone knows where I might post my code and let the Pro's have at it, I would apprecaite it. TIA.

Buffie

Replies
Dustin Taylor
Dustin Taylor
StrataFrame Team Member (938 reputation)
Group: StrataFrame Users
Posts: 364, Visits: 771
So you are bulding the command in .NET via SqlCommandBuilder?  What data are you wanting to delete first? The entire existing table in SQL? Any records in the table matching entries in your array? Something else?

Forgive me, I'm a bit slow at times Smile

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Also, when you say that you are trying to save an array to a database, are you wanting to create a new row for each array element or store an array within a single row of a record?  This could alter our response as well.
Terry Bottorff
Terry Bottorff
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 448, Visits: 12K
Yes to both of your questions. 1 row for each array element and delete All data in the table before I start saving the new array data.

TIA.

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Well, you can just add a new row for each array element by enumerating the array.  So you may want to create a method on the BO that accepts an array and creates the record:

Public Sub CreateRecordsByArray(ByVal e As Integer())
    '-- Place any deletion logic here to remove any undesired records from within the BO or back at the server. 

    '-- Cycle through all of the array rows and add a record for each row
    For Each i As Integer in e
         Me.NewRow()
         Me.MyField = i
    Next
End Sub


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search