473,387 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Error conversion in asp page calling SQL

Hi Group,
I get the following error.
Syntax error converting the varchar value ' WHERE application.RegNo =
148997' to a column of data type int.

I've got an asp.net form which allows the user enters in some criteria and
search. The datatype field for regno is int. I've used the following in my
page and my sql:

If Trim(txtRegNo.Text) <"" Then
strWhere = strWhere & "application.RegNo = '%"
& txtRegNo.Text & "%'"
blnElementAdded = True
blnSearchMainOnly = True
End If

How can I get over this problem.

TIA

Jun 27 '08 #1
1 835
If the field type in the database is int don't put the value in quotes (and
%s) in the sql

e.g.

If Trim(txtRegNo.Text) <"" Then
strWhere = strWhere & "application.RegNo = " & txtRegNo.Text &
blnElementAdded = True
blnSearchMainOnly = True
End If

Kind regards

Rob

"axapta" <ja********@gmail.comwrote in message
news:5F**********************************@microsof t.com...
Hi Group,
I get the following error.
Syntax error converting the varchar value ' WHERE application.RegNo =
148997' to a column of data type int.

I've got an asp.net form which allows the user enters in some criteria
and search. The datatype field for regno is int. I've used the following
in my page and my sql:

If Trim(txtRegNo.Text) <"" Then
strWhere = strWhere & "application.RegNo = '%"
& txtRegNo.Text & "%'"
blnElementAdded = True
blnSearchMainOnly = True
End If

How can I get over this problem.

TIA
Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Hemant Shah | last post by:
Folks, I have DB2 UDB 7.2 EE installed on AIX 5.2 system. I think I am at latest fixpack, see output of lslpp below. I have also installed DB2 UDB 7.2 EE on RedHat Linux 7.3 I believe that is...
14
by: sachin_mzn | last post by:
Hi, Why I am not getting any run time error while accessing a freed memory in following code. This is printing h in std output. #include<stdio.h> main() { char* buffer = (char*)malloc(6);...
5
by: Gang Zhang | last post by:
Hi, I have 2 overloaded functions as below: myfunc(byval val as Decimal) as string myfunc(byval val as String) as string When calling the function with a single like: dim num1 as single...
2
by: Aleksandar | last post by:
Hi, I need to convert set of Java classes exported from IBM Modeling environment to C# for implementation. When I invoke JCLA conversion from File->Open->Convert in Visual Studio 2005 it starts...
2
by: Jukka Aho | last post by:
When converting Unicode strings to legacy character encodings, it is possible to register a custom error handler that will catch and process all code points that do not have a direct equivalent in...
1
by: petschy | last post by:
hello, i've run into an error when qualifying a copy ctor 'explicit'. the strange thing is that i get a compiler error only if the class is a template and declare the variable as X<Zx = y....
9
by: i | last post by:
#include<stdio.h> #include<conio.h> #include<process.h> #include<string.h> char ch; int n,m; void main(); char check(int,int,char); void cash(int,int,char); void debit_card(int,int,char);
0
Dököll
by: Dököll | last post by:
Hey Gang! What do you make of this error: I am attempting to read an Access Table, while all seems well in the code, looks like it is asking me to format form fields, what are your...
0
by: Yoav | last post by:
Hello, I have been trying to enter SQL statmenbts to DB2 control center command line. I saw that user "Thames" wrote to you: > I have to repost my question for help. > > Yesterday I set up two...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.