convert function

S

shank

I'm getting the following error...

Microsoft OLE DB Provider for SQL Server error '80040e07'
Disallowed implicit conversion from data type varchar to data type money,
table 'wsOrders', column 'ShippingCost'. Use the CONVERT function to run
this query.

What I gather is that I'm trying to insert a varchar into a money field.
That is not the case however. Both fields are money. I'm going from one SQL
table on serverA to an identical table on SQL serverB.

My variable is setup like...
<% io_ShippingCost = (rsOrders.Fields.Item("ShippingCost").Value) %>

My insert statement is...
<%
Dim DataConn
Set DataConn = Server.CreateObject("ADODB.Connection")
DataConn.Open MM_KasKSS_STRING
SQL = "INSERT INTO wsOrders (ShippingCost) "
SQL = SQL & "Values ('" & io_ShippingCost & "')"
DataConn.Execute(SQL)
%>

What am I doing wrong?
Does anyone have examples of the CONVERT function?
thanks!
 
B

Bob Barrows

shank said:
I'm getting the following error...

Microsoft OLE DB Provider for SQL Server error '80040e07'
Disallowed implicit conversion from data type varchar to data type
money, table 'wsOrders', column 'ShippingCost'. Use the CONVERT
function to run this query.
SQL = SQL & "Values ('" & io_ShippingCost & "')"
DataConn.Execute(SQL)
%>

What am I doing wrong?
thanks!

What you are doing wrong is using string delimiters around that numeric
value. Response.Write that SQL variable and verify that the resulting
statement will run in query analyzer before attempting to run it from asp.

The line should be:
SQL = SQL & "Values (" & io_ShippingCost & ")"
Does anyone have examples of the CONVERT function?
Not needed in this case, but have you looked in Books Online (BOL)? It
should be installed on your pc - look in the SQL Server program group in
your Windows Start menu.

Bob Barrows
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top