|
-
Nov 13th, 2009, 04:02 PM
#1
Thread Starter
Hyperactive Member
Help with SQL query
I am having a problem getting my head around a query. What I want it to do is this. I want to be able to list all available rooms of a certain type between 2 dates and display the result is a dgv so that the user can select the available room(s). The information is held in 2 files:
Calendar
---------
Date
AccountNumber
RoomNo
Status
Rooms
------
RoomNo
RoomType
The 3 fields on the form would be txtArriveDate, txtDepartDate & txtRoomType. I know I can setup a new tableadapter and bind it to the dgv, but it is the query that I am having a problem with.
Any help on this would be appreciated.
Computerman
It was much easier in VB6, but I am now liking Vb.Net alot more. 
-
Nov 13th, 2009, 04:19 PM
#2
Re: Help with SQL query
strSQL = "Select RoomNo,RoomType "
strSQL &= "From Rooms "
strSQL &= "Where "
strSQL &= " RoomType = txtRoomType AND "
strSQL &= " Status = 'Avail' AND "
strSQL &= " Date Beteen '" & Me.txtArriveDate.Text &"' AND '" & Me.txtDepartDate & "'"
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Nov 13th, 2009, 05:19 PM
#3
Fanatic Member
Re: Help with SQL query
bad practice with that query, much better off using parameters to protect against any possible sql injection.
Where I'm from we only have one bit of advice for new comers: "If you hear banjos, turn and run".
VS 2008 .NetFW 2.0
-
Nov 13th, 2009, 05:24 PM
#4
Thread Starter
Hyperactive Member
Re: Help with SQL query
 Originally Posted by BackWoodsCoder
bad practice with that query, much better off using parameters to protect against any possible sql injection.
What do you mean by that?
Computerman
It was much easier in VB6, but I am now liking Vb.Net alot more. 
-
Nov 13th, 2009, 09:11 PM
#5
Re: Help with SQL query
 Originally Posted by computerman
What do you mean by that?
Computerman
Have a look at this FAQ article.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|