borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (how do you store arrays in Oracle 9i + ADO 2.7)Next Topic (Using ADO Controls) New Topic New Poll Post Reply
AndreaVB Forum : Database : ? parameter in sql string
Poster Message
ivoke
Level: Guest


icon ? parameter in sql string

Hi

Im using a data report in vb6.  Now i want to use a parameter in my select from... string.  It works fine if i place the parameter after WHERE so : SELECT * FROM TABLENAME WHERE id=?  The ? is defined as a parameter.  Now if I use the following SELECT * from ? WHERE ID=1 it doesnt work anymore.  Anybody any idea why?

Grtz

29-09-2004 at 04:06 PM
| Quote Reply
GeoffS
Level: VB Lord


Registered: 29-09-2004
Posts: 536
icon Re: ? parameter in sql string

Hi ivoke,
A parameter is a parameter - the value that you are searching for in a field in a table. You cannot use it to represent the actual table. If you want to change the table from which you are selecting data then use a string variable.

EG
Dim strTableName as String

"SELECT * FROM " & strTableName & " WHERE ID=1"



____________________________
multi-tasking - the ability to hang more than one app. at the same time.

30-09-2004 at 08:09 AM
View Profile Send Email to User Show All Posts | Quote Reply
ivoke
Level: Guest

icon Re: ? parameter in sql string

Ok

Thx

Ivoke

03-10-2004 at 04:16 PM
| Quote Reply
AndreaVB Forum : Database : ? parameter in sql string
Previous Topic (how do you store arrays in Oracle 9i + ADO 2.7)Next Topic (Using ADO Controls) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder