Solved

Syntax error converting varchar to data type int

Posted on 2006-11-20
4
265 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 143

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 143

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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
pin image to base of site 14 366
HELP.. background images in eblasting 25 385
How Can I Get A Back Button To Work On My Website? 1 133
Adobe Products Forum? 3 172
For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

739 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