Casting
Does anyone know of way in ASP to cast an integer to a string?
View RepliesDoes anyone know of way in ASP to cast an integer to a string?
View RepliesI'm working on an application that uses a DbDataReader to retrieve
information from a SQL Server 2005 column, then put that data into object
variables. My code looks like this:
value = (int)dbReader["value"]
For column types of int, this works fine. However, for tinyint or smallint,
I get an invalid cast error.Is there a way to make this work?
ive got a form which takes in someone's age.
request.form("Age")
and then using a stored procedure i want to stick that age into a table in my DB (SQL server) The data type of the table where age goes is type int. So when i run my script to grab the age from the form it tells me :
"Error converting data type varchar to int."
So how would i get around that?
we have a recordset return by a stored procedure from MS SQL. basically this recordset is an integer value, but when we are checking is value something strange happens :
if RS(0) = -1 then
...
end
for example RS(0)=46 and anyway our program runs what is inside the if ...end structure..
how can we cast -1 to integer... something like in C++ : (int)(-1).... in order to make sure that -1 in integer.
I need to pass an integer as a query string when reloading a page - ie:
If Request.QueryString("record") <> "" Then recordNumb = CInt(Request.QueryString("record"))
...
...
recordNumb = recordNumb + 1
<A HREF="add_records.asp?record=recordNumb">next record</A>
I get
Quote:
Type mismatch: 'CInt'
any thoughts?
IF variable MOD 2 = 1 THEN
Where variable comes from a textbox where the user should enter an integer. How can I avoid string or type errors when the user doesn't enter anything or something other than an integer?