-
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^^
-
Y dont you just choose the desired fields when adding the oledbdadaadapter? Run the query builder and just add fileds you need.
-
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 .
-
^^ 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
-
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
-
You might need to read more about dataview then to filter your data .