Casting

Does anyone know of way in ASP to cast an integer to a string?

View Replies


ADVERTISEMENT

Casting Tinyint

I'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?

View Replies View Related

Casting From Varchar To Int In ASP

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?

View Replies View Related

Integer And Casting

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.

View Replies View Related

Type Casting A Query String

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?

View Replies View Related

Variable Explicit Casting Type

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?

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved