Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 150,098 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,869 people online right now. Registration is fast and FREE... Join Now!




Confused on SQL in VB2005

 
Reply to this topicStart new topic

Confused on SQL in VB2005

TuxBrewer
21 Apr, 2008 - 03:32 PM
Post #1

New D.I.C Head
*

Joined: 6 Oct, 2007
Posts: 9


My Contributions
I am using VB2005 and trying to write an SQL statement to search a database and return the values to my VB program.

Sounds like it should be simple. I am just trying to query the number of records that match a certain parameter.

CODE


SELECT COUNT(*) FROM Reservation Where (([Check-in Date] >= @checkin) AND ([Check-out Date] <= @checkout) And [Room Name] = @roomName)



Problem is I dont know where the Query is sticking the value of count so I can see what the result is. Can someone point me in right direction?

TB
User is offlineProfile CardPM
+Quote Post

Jayman
RE: Confused On SQL In VB2005
21 Apr, 2008 - 07:36 PM
Post #2

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,319



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
Moved to VB.NET.

Use the ExecuteScalar method of the SqlCommand object to execute your query and store the value returned in a variable.

ExecuteScalar method
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 12:27AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month