Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select statment error

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi
I using MSVisual InterDiv and working in ASP page
and I wrote there lines in VBscript to select from
a table ( Table ) :


Sub Button1_onclick()
Rec1.close()
Dim Str
Str="select * from Table where "+List1.getValue()+" like '"+txt.value+"'"
Rec1.setSQLText(Str)
Rec1.open()
End Sub

----And when I view it in browser ( Explorer 5.0 ) and click on the button
this error Massage Appears :

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access 97 Driver] Syntax error in FROM clause.

/Prj2_Local/_ScriptLibrary/Recordset.ASP, line 466

……
So cloud you help me to find the reason of this error

 
So you have a Combo-Box/List with the names of some columns in the database table called "Table", and a text box in which you enter the text you are looking for.

The result SQL command may look like:

SELECT * FROM Table WHERE Column1 LIKE 'find me'

The error would suggest that the table called "Table" does not exist or is a reserved word - i.e. it needs to be quoted. Try square brackets:

SELECT * FROM
WHERE Column1 LIKE 'find me'
(Content Management)
 
Mr. M

Try this:

Str = "select * from Table "
Str = Str & " where " & List1.getValue()
Str = Str & " like '%" & txt.value & "%'"

But be absolutely sure that List1.getValue()
is returning valid table column names.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top