Re: changing a datasets contents
- From: "Heath P. Dillon" <Heath@xxxxxxxxxxxxx>
- Date: Sat, 14 Mar 2009 20:11:54 +1100
Hi Miro
Firstly, thanks for your assistance on this.
I have taken your suggestions below, and have managed to get a little further than before.
I have added a dataset to my project. When I open the dataset, I then add a table adapter, and define my query etc. I end up with datatable1 above a datatable1tableadapter. On the datatable1tableadapter I have added a parameter which now appear along side the fill,getdata in the datatable1tableadapter
So I think I have the first part correct.
The problem I have is that I want to be able to change the value in my select statements where clause in my code.
I can't seem to find any way to access the select statement that I created in the table adapter, nor understand how the parameter I created links to this query.
Be greatful for any more pointers that help me sort this.
Thanks
I have tried to work through your suggested solutions
"Miro" <miro@xxxxxxxxx> wrote in message news:u1olkb%23oJHA.1252@xxxxxxxxxxxxxxxxxxxxxxx
You will be able to.
Once you setup a query / table adapter with a "@Filter"
then when you call your tableadapter, it takes in parameters....
Create a new project, a dummyhelloworld,
attach a dummy dataset,
right click in the dataset table, and add a new table adapter,
take the table adapter and add a filter,
Nameit something like "helloworldtest"
on the form, when you "drag and drop" the fields on the form, go to the code, and look for the tableadapter.
Change the tableadapter that was added to the one you just created "helloworldtest"...
you should see what I mean with the parameters being passed into it.
If you need some screenshot examples - I can create some for you - let me know.
Miro
"Heath P. Dillon" <Heath@xxxxxxxxxxxxx> wrote in message news:D99EC750-08F7-4128-9ABF-51E1A03ED2B3@xxxxxxxxxxxxxxxxI don't want to do this via the wizard, as I need this to change as the user uses the program.
I need to be able to change the query via vb.net at run time
Any thoughts ?
"Miro" <miro@xxxxxxxxx> wrote in message news:%23aBeg4xoJHA.3896@xxxxxxxxxxxxxxxxxxxxxxxIf you used the wizard, take a look at the parameter class.
It will create a variable with an @symbol...
If you are using an access table - it will be a question mark.
example on access: (written in notepad)
SELECT Name
FROM Names
Where CustID = ?
or
In SQL ( written in notepad )
SELECT Name
FROM Names
Where CustID = @Name
If you click on your tableadapter and click on Query Builder, you should see a "Filter" column. That is the column you want to put in the @/? parameter.
So just go to your table, either edit the table adapter you have, or create a new one and call that one.
Hope that makes sense.
Miro
"NoSpamMan" <no@xxxxxxxx> wrote in message news:OSq9RfxoJHA.5980@xxxxxxxxxxxxxxxxxxxxxxxHi,
I created a dataset via adding a new item (dataset) to my project. Following through the wizard I have now complete a data set that contains data. (select the tables, create the joins and enter the first where clause (abc=1). This works fine.
My question is that the query that I build in the dataset wizard in my project, needs to now change its where clause. (select ...... where abc= 1 now needs to be abc=2)
Is there a way to change the datasets select statement ?
How do I do this in my vb.net code ? I can't have a dataset for every possible where clause, as there are several thoughs values for abc ?
.
- Follow-Ups:
- Re: changing a datasets contents
- From: Miro
- Re: changing a datasets contents
- References:
- changing a datasets contents
- From: NoSpamMan
- Re: changing a datasets contents
- From: Miro
- Re: changing a datasets contents
- From: Heath P. Dillon
- Re: changing a datasets contents
- From: Miro
- changing a datasets contents
- Prev by Date: Re: Right justify dollars
- Next by Date: RE: vb.net forms connected to controls
- Previous by thread: Re: changing a datasets contents
- Next by thread: Re: changing a datasets contents
- Index(es):
Relevant Pages
|