Solved

Syntax error converting varchar to data type int

Posted on 2006-11-20
4
259 Views
Last Modified: 2010-08-05
Dear experts,

  I'm creating a search and result page in ASP using Dreamweaver MX 2004.

The URL Paramter passed from the search.asp page is a varchar datatype.  

I attempt to create a recordset in result.asp page using Dreamweaver MX 2004's Add Recordset Server Beheavior and add a Variable in Variables list as follow:

Name           Default Value     Run-Time Value      
-------          ----------------    ---------------------
srchParm     3ABC12345        Request.QueryString("txt_search")


When I press Test button, Dreamweaver MX 2004 returns an error message: Syntax error converting varchar "3ABC12345" to data type int


My Question:

Why would Dreamweaver MX 2004 want to convert the value of the variable to int datatype??
When I leave Default Value blank, DW MX 2004 returns an error message saying the default value is missing and the recordset cannot be saved.

I need to be able to show the search result base on the searching parameter on the search.asp page.  How do I get it to work?

Thank you very much!!!
0
Comment
Question by:cuconsortium
  • 2
4 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17985251
please show the sql query / procedure code that you use.
the error is in there.

typically, it happens when you are trying to append a varchar and a numerical data. sql server gives priority to the numerical data (why, i don't know, but it's like that), so you have to explicitely convert the numerical value to varchar:

this will fail with your error:
select 'ABC' + 1

this will work:
select 'ABC' + convert(1 as varchar)

0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 18125422
I would prefer the PAQ with no points refunded, as the answer has been given IMHO... despite of the missing feedback of the questionner :-(
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 18153499
PAQed with no points refunded (of 500)

Computer101
EE Admin
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now