|
 |
asp_databases thread: Strange datatyping
Message #1 by "Sandra" <salau@p...> on Tue, 21 May 2002 23:29:19
|
|
Hi,
I'm attempting to increment numeric fields and compare them, but I always
end up with a 'type mismatch' error.
The database I'm currently using is Oracle-based: the table I'm using is
described as such:
------------------------------------------------------------------------
create table Course
(
...
, MaxNum integer
, CurrentNum integer
, WaitMaxNum integer
, WaitCurrentNum integer
...
);
------------------------------------------------------------------------
And the following code is:
------------------------------------------------------------------------
'***************************
'Variable declarations
'***************************
dim classNum
dim MaxNum
dim objConn
dim objRS
'***************************
'Implementation'
'***************************
set objConn = Server.CreateObject("ADODB.Connection")
set objRS = Server.CreateObject("ADODB.RecordSet")
objConn.Open Application("comptrain_ConnectionString")
objRS.Open "Select MaxNum, CurrentNum, WaitMaxNum, WaitCurrentNum from
Course where CourseNum = ' " & Session("IDNumber") & " ' ", objConn,
adOpenStatic, adLockOptimistic, adCmdText
classNum = objRS("CurrentNum")
maxNum = objRS("MaxNum")
if classNum < maxNum then <------here they claim a type mismatch
classNum = classNum + 1
end if
'***************************
Any help would be greatly appreciated!
Sandra ^_^
Message #2 by "Drew, Ron" <RDrew@B...> on Wed, 22 May 2002 08:12:36 -0400
|
|
Null allowed??
-----Original Message-----
From: Sandra [mailto:salau@p...]
Sent: Tuesday, May 21, 2002 7:29 PM
To: ASP Databases
Subject: [asp_databases] Strange datatyping
Hi,
I'm attempting to increment numeric fields and compare them, but I
always
end up with a 'type mismatch' error.
The database I'm currently using is Oracle-based: the table I'm using is
described as such:
------------------------------------------------------------------------
create table Course
(
...
, MaxNum integer
, CurrentNum integer
, WaitMaxNum integer
, WaitCurrentNum integer
...
);
------------------------------------------------------------------------
And the following code is:
------------------------------------------------------------------------
'***************************
'Variable declarations
'***************************
dim classNum
dim MaxNum
dim objConn
dim objRS
'***************************
'Implementation'
'***************************
set objConn =3D Server.CreateObject("ADODB.Connection")
set objRS =3D Server.CreateObject("ADODB.RecordSet")
objConn.Open Application("comptrain_ConnectionString")
objRS.Open "Select MaxNum, CurrentNum, WaitMaxNum, WaitCurrentNum from
Course where CourseNum =3D ' " & Session("IDNumber") & " ' ", objConn,
adOpenStatic, adLockOptimistic, adCmdText
classNum =3D objRS("CurrentNum")
maxNum =3D objRS("MaxNum")
if classNum < maxNum then <------here they claim a type mismatch
classNum =3D classNum + 1
end if
'***************************
Any help would be greatly appreciated!
Sandra ^_^
Message #3 by "Futuh COKLU" <futuh@p...> on Wed, 22 May 2002 15:17:38 +0300
|
|
Hi Sandra,
You have to declare your variables types.
Dim classNum As Integer
Dim MaxNum As Integer
Dim objConn As ADODB.Connection
Dim objRS As ADODB.Recordset
Futuh
----- Sandra Writing: -----
Hi,
I'm attempting to increment numeric fields and compare them, but I always
end up with a 'type mismatch' error.
The database I'm currently using is Oracle-based: the table I'm using is
described as such:
------------------------------------------------------------------------
create table Course
(
...
, MaxNum integer
, CurrentNum integer
, WaitMaxNum integer
, WaitCurrentNum integer
...
);
------------------------------------------------------------------------
And the following code is:
------------------------------------------------------------------------
'***************************
'Variable declarations
'***************************
dim classNum
dim MaxNum
dim objConn
dim objRS
'***************************
'Implementation'
'***************************
set objConn = Server.CreateObject("ADODB.Connection")
set objRS = Server.CreateObject("ADODB.RecordSet")
objConn.Open Application("comptrain_ConnectionString")
objRS.Open "Select MaxNum, CurrentNum, WaitMaxNum, WaitCurrentNum from
Course where CourseNum = ' " & Session("IDNumber") & " ' ", objConn,
adOpenStatic, adLockOptimistic, adCmdText
classNum = objRS("CurrentNum")
maxNum = objRS("MaxNum")
if classNum < maxNum then <------here they claim a type mismatch
classNum = classNum + 1
end if
'***************************
Any help would be greatly appreciated!
Sandra ^_^
Message #4 by "Sandra" <salau@p...> on Wed, 22 May 2002 14:55:50
|
|
Hi Futuh,
I tried that (declaring them) and I ended up with this error message:
-----------------------------------------------------
Microsoft VBScript compilation error '800a0401'
Expected end of statement
/edreg/register.asp, line 130
dim classNum as Integer
-------------^
-----------------------------------------------------
All my db connections are in place and they work for reading data except
for reading and comparing integers.
What else am I missing?
Thanks,
Sandra
--------------------------------------------
You have to declare your variables types.
Dim classNum As Integer
Dim MaxNum As Integer
Dim objConn As ADODB.Connection
Dim objRS As ADODB.Recordset
--------------------------------------------
Message #5 by "Peter Foti (PeterF)" <PeterF@S...> on Wed, 22 May 2002 10:36:26 -0400
|
|
Hi Sandra,
Try this instead:
classNum = CInt( trim( objRS("CurrentNum") ) )
maxNum = CInt( trim( objRS("MaxNum") ) )
I *think* this will solve you problem. :)
Regards,
Pete
> -----Original Message-----
> From: Sandra [mailto:salau@p...]
> Sent: Tuesday, May 21, 2002 11:29 PM
> To: ASP Databases
> Subject: [asp_databases] Strange datatyping
>
>
> Hi,
>
> I'm attempting to increment numeric fields and compare them,
> but I always
> end up with a 'type mismatch' error.
>
> The database I'm currently using is Oracle-based: the table
> I'm using is
> described as such:
>
> --------------------------------------------------------------
> ----------
> create table Course
> (
> ...
> , MaxNum integer
> , CurrentNum integer
> , WaitMaxNum integer
> , WaitCurrentNum integer
> ...
> );
> --------------------------------------------------------------
> ----------
>
> And the following code is:
>
> --------------------------------------------------------------
> ----------
> '***************************
> 'Variable declarations
> '***************************
> dim classNum
> dim MaxNum
> dim objConn
> dim objRS
>
> '***************************
> 'Implementation'
> '***************************
>
> set objConn = Server.CreateObject("ADODB.Connection")
> set objRS = Server.CreateObject("ADODB.RecordSet")
>
> objConn.Open Application("comptrain_ConnectionString")
> objRS.Open "Select MaxNum, CurrentNum, WaitMaxNum,
> WaitCurrentNum from
> Course where CourseNum = ' " & Session("IDNumber") & " ' ", objConn,
> adOpenStatic, adLockOptimistic, adCmdText
>
> classNum = objRS("CurrentNum")
> maxNum = objRS("MaxNum")
>
> if classNum < maxNum then <------here they claim a type mismatch
> classNum = classNum + 1
> end if
> '***************************
>
> Any help would be greatly appreciated!
>
> Sandra ^_^
>
>
Message #6 by "Futuh COKLU" <futuh@p...> on Wed, 22 May 2002 18:36:17 +0300
|
|
I'm not sure but, maybe your problem is to use "maxNum" word in FieldName
and Variable too. Better you change your variables like:
Dim intClassNum As Integer
Dim intMaxNum As Integer
Dim adoObjConn As ADODB.Connection
Dim adoObjRS As ADODB.Recordset
Futuh
----- Original Message -----
Hi Futuh,
I tried that (declaring them) and I ended up with this error message:
-----------------------------------------------------
Microsoft VBScript compilation error '800a0401'
Expected end of statement
/edreg/register.asp, line 130
dim classNum as Integer
-------------^
-----------------------------------------------------
All my db connections are in place and they work for reading data except
for reading and comparing integers.
What else am I missing?
Thanks,
Sandra
--------------------------------------------
You have to declare your variables types.
Dim classNum As Integer
Dim MaxNum As Integer
Dim objConn As ADODB.Connection
Dim objRS As ADODB.Recordset
--------------------------------------------
Message #7 by "Sandra" <salau@p...> on Wed, 22 May 2002 17:01:01
|
|
Thanks Pete, it worked!
Sandra
> Hi Sandra,
Try this instead:
classNum = CInt( trim( objRS("CurrentNum") ) )
maxNum = CInt( trim( objRS("MaxNum") ) )
I *think* this will solve you problem. :)
Regards,
Pete
Message #8 by "Peter Foti (PeterF)" <PeterF@S...> on Wed, 22 May 2002 12:00:36 -0400
|
|
Futuh, you are incorrect. The problem is that ASP uses VBScript and
VBScript does not allow the datatype to be declared as you are
suggesting. That is a VB feature.
Regards,
Peter
> -----Original Message-----
> From: Futuh COKLU [mailto:futuh@p...]
> Sent: Wednesday, May 22, 2002 11:36 AM
> To: ASP Databases
> Subject: [asp_databases] Re: Strange datatyping
>
>
> I'm not sure but, maybe your problem is to use "maxNum" word
> in FieldName
> and Variable too. Better you change your variables like:
> Dim intClassNum As Integer
> Dim intMaxNum As Integer
> Dim adoObjConn As ADODB.Connection
> Dim adoObjRS As ADODB.Recordset
>
>
> Futuh
>
> ----- Original Message -----
>
> Hi Futuh,
>
> I tried that (declaring them) and I ended up with this error message:
>
> -----------------------------------------------------
>
> Microsoft VBScript compilation error '800a0401'
> Expected end of statement
> /edreg/register.asp, line 130
> dim classNum as Integer
> -------------^
>
> -----------------------------------------------------
> All my db connections are in place and they work for reading
> data except
> for reading and comparing integers.
>
> What else am I missing?
>
> Thanks,
> Sandra
>
> --------------------------------------------
> You have to declare your variables types.
> Dim classNum As Integer
> Dim MaxNum As Integer
> Dim objConn As ADODB.Connection
> Dim objRS As ADODB.Recordset
> --------------------------------------------
>
>
>
>
Message #9 by "Futuh COKLU" <futuh@p...> on Thu, 23 May 2002 09:53:18 +0300
|
|
Correct Peter, it was my mistake.
Futuh
----- Original Message -----
From: "Peter Foti (PeterF)" <PeterF@S...>
Futuh, you are incorrect. The problem is that ASP uses VBScript and
VBScript does not allow the datatype to be declared as you are
suggesting. That is a VB feature.
Regards,
Peter
|
|
 |