Link to home
Start Free TrialLog in
Avatar of kavvis
kavvis

asked on

VB.NET Query Builder

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





 
Avatar of Rouchie
Rouchie
Flag of United Kingdom of Great Britain and Northern Ireland image

I don't think you need the quotes...


SELECT     ID, Datum, Tid, Tag1, Tag2, Tag3
FROM         Agnesberg
WHERE     (Datum BETWEEN @Starttemp AND @Stoptemp)
In your WHERE Clause
...WHERE DATUM>@Starttp AND DATUM
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)
ASKER CERTIFIED SOLUTION
Avatar of Rouchie
Rouchie
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kavvis
kavvis

ASKER

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