Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 ODBC Drivers error '80040e14'
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

psalesses
New Member

50 Posts

Posted - 25 March 2002 :  13:17:38  Show Profile
I'm trying to write an sql statement that would check the database to see if there is already a value with that name in the DB.

When people register, they enter the site name they want, then the script should go into the table, select the sitedirectory column and see whether or not there is a value in that column with the same value...

<%
sitedirectory = "LBBruins"
strSql = "SELECT * FROM teamsites WHERE sitedirectory = sitedirectory"
%>


when i execute that code, it gives me this:

[Microsoft][ODBC SQL Server Driver][SQL Server]The text, ntext, and image data types cannot be used in the WHERE, HAVING, or ON clause, except with the LIKE or IS NULL predicates.

/teamsites/scripts/register/step2_inc.asp, line 22

any ideas how I could check the db if I cant use where?!?!


ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 25 March 2002 :  13:32:14  Show Profile  Send ruirib a Yahoo! Message
You may have problems with the column types you are using. Before that it looks like you are making a mistake when creating the SQL Query. Probably it should go like this:

strSql = "SELECT * FROM teamsites WHERE sitedirectory =""" & sitedirectory & """;"

You may have to change the operator used for the comparison depending on the type of the sitedirectory field. I'm just saying this because of the error message.

-------------------------------------------------
Installation Guide | Do's and Dont's | MODs
Go to Top of Page

psalesses
New Member

50 Posts

Posted - 25 March 2002 :  14:23:36  Show Profile
changing it to your string got rid of the error with the "cant use where statement" but now it gave me this one:

Code:
sitedirectory = "lbbruins"
strSql = "SELECT sitedirectory FROM teamsites WHERE sitedirectory=""" & sitedirectory & """;"

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

[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'lbbruins'.

/teamsites/scripts/register/step2_inc.asp, line 10

any ideas now?




Go to Top of Page

nomad_2k
Junior Member

United Kingdom
173 Posts

Posted - 25 March 2002 :  14:51:49  Show Profile
I don't think double quotes (") work in sql you need to use single quotes (') like this:

strSql = "SELECT * FROM teamsites WHERE sitedirectory ='" & sitedirectory & "';"

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.3 seconds. Powered By: Snitz Forums 2000 Version 3.4.07