Solved

Syntax error converting varchar to data type int

Posted on 2006-11-20
4
256 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

708 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

13 Experts available now in Live!

Get 1:1 Help Now