Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: SV: SV: How to use the convert function to convert Datatype while using the query??


Message #1 by =?iso-8859-1?Q?H=E5kan_Frennesson?= <hakan@c...> on Thu, 7 Mar 2002 19:37:07 +0100
Use CDbl instead of CLng....



Is the Convert function part of VBScript..?



Hakan



-----Ursprungligt meddelande-----

Fr=E5n: H=E5kan Frennesson [mailto:hakan@c...]

Skickat: den 7 mars 2002 19:27

Till: ASP Databases

=C4mne: [asp_databases] SV: How to use the convert function to convert

Datatype while using the query??





Hi!



Maybe you could try this:



insert into 

Horses(fk_RaceID,TabNum,Barrier,Ranking,Chance,Price,Presort)

values('" & RaceID & "', '" & TabNum & "','" & Barrier & "','" & Ranking 



& "','" & Chance & "'," & Clng(Price) & ",'" & Presort & "')



Hakan



-----Ursprungligt meddelande-----

Fr=E5n: kaps [mailto:stradbroke@c...]

Skickat: den 7 mars 2002 08:25

Till: ASP Databases

=C4mne: [asp_databases] How to use the convert function to convert

Datatype while using the query??





helo,



I got a little question about this Convert Function to convert String to 



Money datatype.



"Price" is a "Money" datatype in db and when i try to add/update the

record it throws an error and ask me to use the Convert function!



I found out about that as well but the trouble is that if i use the same 



query in Query Analyser of SQL Server it works well but something goes

wrong when i use it with ASP.



The Query i have used for the add is:



insert into 

Horses(fk_RaceID,TabNum,Barrier,Ranking,Chance,Price,Presort)

values('" & RaceID & "', '" & TabNum & "','" & Barrier & "','" & Ranking 



& "','" & Chance & "',(Select CONVERT(Money,Price)),'" & Presort & "')



For adding the data for the same table gives me error:



"Only scalar expressions are allowed"





Query for Updating Record is:



update Horses set TabNum =3D '" & TabNum & "', Barrier =3D '" & Barrier 

& "',

Ranking =3D '" & Ranking & "', Chance =3D '" & Chance & "', Price =3D 

(Select

CONVERT(Money,Price)), Presort =3D '" & Presort & "' where HorseID =3D 

'" &

HorseID & "'





Can anyone help me please?



Your reply will be appreciated!!



Regards.




$subst('Email.Unsub').








$subst('Email.Unsub').




  Return to Index