VB.NET Query Builder

kavvis
kavvis used Ask the Experts™
on
Hi!
I have just found this function in the datset...

What a great function!

However I need some help...
This is what I want to to.

1.  Make the query with this new function
Search for example in my databas.

SELECT     ID, Datum, Tid, Tag1, Tag2, Tag3
FROM         Agnesberg
WHERE     (Datum BETWEEN '@Starttemp' AND '@Stoptemp')



But I get problem when I do this.. this is how I doit!

Dim Starttemp, Stoptemp As String
        Starttemp = "11:00:00"
        Stoptemp = "13:00:00"

        Me.AgnesbergTableAdapter.FillBy(Me.HammarDataSet.Agnesberg)

If I instead write like this


SELECT     ID, Datum, Tid, Tag1, Tag2, Tag3
FROM         Agnesberg
WHERE     (Datum BETWEEN '13:01:18' AND '14:01:18')

then it workes!



How do I then make  this adresses dynamic?

//Kavvis





 
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
I don't think you need the quotes...


SELECT     ID, Datum, Tid, Tag1, Tag2, Tag3
FROM         Agnesberg
WHERE     (Datum BETWEEN @Starttemp AND @Stoptemp)
John (Yiannis) ToutountzoglouInstructor Multiengine Pilot

Commented:
In your WHERE Clause
...WHERE DATUM>@Starttp AND DATUM
John (Yiannis) ToutountzoglouInstructor Multiengine Pilot

Commented:
Or if this statement is in your tableadapter then in your dataset designer create new query and add this where clause.so when you call the table adapter
 
me.AgnesbergTableAdapter.fill(hamardataset.Agnesber,startemp,stoptemp)
kavvis - did you try without the quotes as in my original reply?

Author

Commented:
Sorry I have been on vacation! Thank you now I close this thred!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial