Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 7th, 2004, 05:28 AM
Registered User
 
Join Date: Apr 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to get multiple sql statements in vb.net

Hi,
I'm building an app that has to use more than one sql statement to get all the data I want. something like this
SELECT date, teacher, room, hour FROM reservations WHERE date = #14-4-2004# AND room = 'B42' AND hour = '1'.

The returned values have to go into labels on a form......
Can anyone tell me how to complete this. The date, room and hour values will be generated by some combolists and a monthdatepicker.



He who dies with the most toys still dies
 
Old April 7th, 2004, 08:40 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hello there..

a few things.. why do you need an sql that returns 3 fields that are the same that you are looking for??

the only thing new from your select is the teacher field...

anyway.. do something like this

dim sSql as string
sSql = "SELECT date, teacher, room, hour FROM reservations WHERE "
sSql = sSql & "date = #" & yourdatepicker.value & "# AND room = '" & comboroom.text
ssql = ssql & "' AND hour = '" & combohour.text & "'"

but i suggest you review what you are doing there...


HTH

Gonzalo
 
Old April 8th, 2004, 09:01 AM
Registered User
 
Join Date: Apr 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thnx, why do I need 3 fields....
This is part of an app that lets the teachers reserve a computerclassroom. They select a date and a room and after that it gets displayed in a nice format that says hour 1 is reserved so you can't have it and so on.....
If I don't do it like this - not enought people here that are not scared of computers and programs- I'll be busy giving support half the time.

I know it is taking the long way home, but my collegues leave me little choice

He who dies with the most toys still dies





Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple LIKE statements melkin MySQL 3 December 17th, 2008 03:38 PM
Multiple SQL Statements from Excel to Access aabnormal Excel VBA 1 September 8th, 2008 11:54 PM
Multiple IIF statements Corey Access 1 November 16th, 2006 05:25 PM
executing multiple statements jae_green PHP Databases 1 July 7th, 2003 02:19 PM
Multiple Insert Statements tp194 Classic ASP Databases 8 June 11th, 2003 01:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.