Results 1 to 21 of 21

Thread: Create a dataset from a Queue Collection (Resolved)

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Nov 2005
    Posts
    259

    Create a dataset from a Queue Collection (Resolved)

    Is it possible to take these Queue items and put them back into a (new) dataset?
    VB Code:
    1. Private Function GetCustomerInfo() As DataSet
    2.         Dim Stores As String() = { _
    3.             CStr(1128), _
    4.             CStr(1129)}
    5.  
    6.         Dim rendomCustQueue As New Queue
    7.         Dim CustomerPicker As New Random
    8.         Dim myrows As DataRow()
    9.         Dim value As Integer
    10.  
    11.         For Each storeNum As String In Stores
    12.             myrows = GetRandomCustomers.Tables(0).Select("LastStore = '" & storeNum & "'")
    13.             If myrows.Length > 0 Then
    14.                 value = CustomerPicker.Next(0, myrows.Length)[b]
    15.                 rendomCustQueue.Enqueue(myrows(value).Item("FullName").ToString)
    16.                 rendomCustQueue.Enqueue(myrows(value).Item("Address").ToString)
    17.                 rendomCustQueue.Enqueue(myrows(value).Item("City").ToString)
    18.                 rendomCustQueue.Enqueue(myrows(value).Item("State").ToString)
    19.                 rendomCustQueue.Enqueue(myrows(value).Item("Zip").ToString)
    20.                 rendomCustQueue.Enqueue(myrows(value).Item("LastStore").ToString)[/b]
    21.             End If
    22.             Dim en As System.Collections.IEnumerator = rendomCustQueue.GetEnumerator()
    23.  
    24.             While en.MoveNext()
    25.                 ' Create and Return Dataset here???
    26.             End While
    27.         Next
    28.     End Function

    I tried this but it didn't work.
    VB Code:
    1. Dim ds As New DataSet
    2.                 Dim dt As New DataTable
    3.  
    4.                 Dim FullName As DataColumn
    5.                 Dim Address As DataColumn
    6.                 Dim City As DataColumn
    7.                 Dim State As DataColumn
    8.                 Dim Zip As DataColumn
    9.                 Dim Store As DataColumn
    10.  
    11.                 FullName = (rendomCustQueue.Enqueue(myrows(value).Item("FullName").ToString))
    12. etc....
    Last edited by FastEddie; Sep 7th, 2006 at 02:27 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width