Results 1 to 6 of 6

Thread: fill a dataset help

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2001
    Posts
    41

    fill a dataset help

    I created the oleDB adapter and the connections using the wizzird in VS.Net pro. Now in the adapter we can genarate a dataset for the sql qurey. which most of the time is select user.* form User etc.



    now the problem comes when i wanted to show the dataset in a datagrid i notice that some of the field i don't need(another word i need to refine the data in the dataset). Is there a way to create the dataset my self using my own OleDBCommand and fill it to a new dataset and then use that in my datagrid?
    I'm kind of used to the wizzard so is it possible that you show me some coding Plz^^

  2. #2
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    Y dont you just choose the desired fields when adding the oledbdadaadapter? Run the query builder and just add fileds you need.
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  3. #3
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Something like this should works fine :

    dim SQLStr as string ="SELECT column1,column2 FROM table1"
    dim ds as new dataset()
    dim adp as new oledbadapter(SQLStr , myconnectionObj)
    adp.fill(ds,tablename)

    I don't have VB.NET here so I can't be sure if syntax is %100 correct but follow same steps .

  4. #4

    Thread Starter
    Member
    Join Date
    Jul 2001
    Posts
    41
    ^^ i know i can do that

    but the ony problem is that i've already done the update part already and i don't want to change any code in the update so that i can store some column to a new dataset

    i think it easy if i go to a new dataset since the update already uses the one created by the adepter

  5. #5

    Thread Starter
    Member
    Join Date
    Jul 2001
    Posts
    41
    after i get my dataset how can i refine it to another dataset


    for example: if i have the following coloum in my exiting dataset
    if i wanted a new dataset with count coloumn for a single user how do i do that.

    existing dataset:
    UserId ,GameId , win ,loss, drawn
    1 1 1 4 0
    1 2 4 3 0
    2 3 1 0 0
    1 4 1 0 0

    how can I use a get the following result:
    the GameID is a PKI and below GameID is the name i wanted for
    the count NOTE: GameID below does not Equal gameID above

    UserId ,GameId, win ,loss, drawn
    1 1 1 4 0
    1 2 4 3 0
    1 3 1 0 0

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    You might need to read more about dataview then to filter your data .

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