Solved

Microsoft OLE DB Provider for SQL Server error '80040e57'

Posted on 2006-07-24
6
1,589 Views
Last Modified: 2008-01-09
Microsoft OLE DB Provider for SQL Server error '80040e57'

Arithmetic overflow error converting numeric to data type numeric.

/USERSELECT.asp, line 98

*********************************
<%
Option Explicit
DIM btnVAL
DIM SRC
DIM sConnStr
DIM OBJdbConn
DIM ACInfo        'ALL CUSTOMER INFO
DIM AOInfo            'ALL ORDER INFO
DIM VLastName
DIM VFirstName
DIM VAddress
DIM VCity
DIM VState
DIM VZip
DIM VPhone
DIM VEmailadd
DIM VITEM1
DIM VQTY1
DIM VPRICE1
DIM VTAX
DIM VSUB
DIM VDISC
DIM VTOTALITEMS
DIM VDATEEXP
DIM VDATERET
DIM VDATEORD
DIM VCLERKID
DIM VCASHRET
DIM VCASHREC
DIM VLOCATION
DIM VSTATUS
DIM VORDERNUM
DIM SQLQuery
DIM RsCustomerList

' LINE 36
%>


<HTML>
<HEAD>
<title>FIND CUSTOMER INFO</title>
</HEAD>
<BODY>


<H3>FIND CUSTOMER INFO - START</H3>
<TABLE WIDTH=600 BORDER=0>
<TR>
<TD VALIGN=TOP COLSPAN=3>
<FONT SIZE=2>
<BODY BGCOLOR="#FFFFFF">
<FORM METHOD="POST" ACTION="USERSELECT.asp">

Phone# <INPUT TYPE="text" NAME="Phone2" SIZE=15 MAXLENGTH=15 VALUE="937"> <BR> <BR> <br>


<%
IF Request.form("btnVAL") <>"" THEN
 SRC = 0
 sConnStr = 0
 OBJdbConn = 0
 ACInfo = 0       'ALL CUSTOMER INFO
 AOInfo      = 0      'ALL ORDER INFO
 VLastName = 0
 VFirstName = 0
 VAddress = 0
 VCity = 0
 VState = 0
 VZip = 0
 set VPHONE      = request.form("PHONE2")
 VEmailadd = 0
 VITEM1 = 0
 VQTY1 = 0
 VPRICE1 = 0
 VTAX = 0
 VSUB = 0
 VDISC = 0
 VTOTALITEMS = 0
 VDATEEXP = 0
 VDATERET  = 0
 VDATEORD = 0
 VCLERKID = 0
 VCASHRET = 0
 VCASHREC = 0
 VLOCATION = 0
 VSTATUS = 0
 VORDERNUM = 0
 SQLQuery = 0
'LINE 91
 src = "C:\Program Files\Microsoft SQL Server\MSSQL\Data\PHILLIPS_data.mdf"
 sConnStr = "Provider=SQLOLEDB;Server=pdcserver;Database=PHILLIPS;" & _
 "UID=sa;PWD=;"
Set OBJdbConn = Server.CreateObject("ADODB.Connection")
OBJdbConn.Open  sConnStr
  ' SQLQuery = "SELECT * FROM CUSTINFO WHERE PHONE LIKE '93727490%'"
    SQLQuery = "SELECT * FROM CUSTINFO WHERE (PHONE = "& vphone &")"
Set RsCustomerList = OBJdbConn.Execute(SQLQuery)  
%>
<TABLE COLSPAN=8 CELLPADDING=5 BORDER=1>
<!-- BEGIN column header row for Customer Table-->
<TR CLASS=thead>
   <TD>FIRST NAME</TD>
   <TD>LAST NAME</TD>
   <TD>ADDRESS</TD>
   <TD>CITY</TD>
   <TD>STATE</TD>
   <TD>ZIP</TD>
   <TD>PHONE</TD>
   <TD>EMAIL ADDRESS</TD>
</TR>

<!--Display ADO Data from Customer Table-->


<% IF RSCUSTOMERLIST.EOF THEN
      RESPONSE.WRITE "THE RECORD DOES NOT EXIST. WOULD YOU LIKE TO ADD A NEW RECORD?" %>
      <A HREF="/addrecord.asp">YES</A><BR><BR>  
 
<% ELSE
      RESPONSE.WRITE "CUSTOMER FOUND. PROCEED TO PLACE NEW ORDER?"%>
      <A HREF="/NEWORDER.ASP">YES</A><BR><BR>  

 <%  END IF
      Do While Not RScustomerList.EOF
   %>
<TR CLASS=tbody>
  <TD> <%= RSCustomerList("FNAME")%> </TD>
  <TD> <%= RScustomerList("LNAME")%></TD>
  <TD> <%= RScustomerList("ADDRESS")%> </TD>
  <TD> <%= RScustomerList("CITY")%> </TD>
  <TD> <%= RScustomerList("STATE")%> </TD>
  <TD> <%= RScustomerList("ZIP")%> </TD>
  <TD> <%= RScustomerList("PHONE")%> </TD>
  <TD> <%= RScustomerList("EMAILADD")%> </TD>
</TR>
<!--Next Row = Record Loop and add to html table-->
<%
RScustomerList.MoveNext
Loop
RScustomerList.Close
Set RScustomerList = Nothing
OBJdbConn.Close
Set OBJdbConn = Nothing
end if
%>
<INPUT TYPE="SUBMIT" NAME="btnval" VALUE="FIND RECORD">      

</TABLE>
</FORM>
</BODY>
</HTML>



0
Comment
Question by:Nmagsaysay
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 

Author Comment

by:Nmagsaysay
ID: 17168059
Help any ideas??  
0
 
LVL 23

Accepted Solution

by:
apresto earned 500 total points
ID: 17168080
Hi Nmagsaysay,

Could you point out line 98

Apresto
0
 

Author Comment

by:Nmagsaysay
ID: 17168575
I'm a noob to ASP/SQL databases.  I've inherited this project.  The original developer is nowhere to be found.  The DB was originally run on a win2k workstation with SQL 2000.  The system/server developed hardware problems and I have the task of moving the DB to a windows XP pro box with SQL 2000.  (This DB runs on an intranet & it is not accessed publicly)

When I launch the asp page to perform a query I get this error.  I’m stuck & I don’t know where to look.  


Microsoft OLE DB Provider for SQL Server error '80040e57'

Arithmetic overflow error converting numeric to data type numeric.

/USERSELECT.asp, line 98



I belive that the code in question is below

'LINE 91

'LINE 92
src = "C:\Program Files\Microsoft SQL Server\MSSQL\Data\PHILLIPS_data.mdf"
'LINE 93
sConnStr = "Provider=SQLOLEDB;Server=pdcserver;Database=PHILLIPS;" & _
'LINE 94
"UID=sa;PWD=;"
'LINE 95
Set OBJdbConn = Server.CreateObject("ADODB.Connection")
'LINE 96
OBJdbConn.Open  sConnStr
'LINE 97  
' SQLQuery = "SELECT * FROM CUSTINFO WHERE PHONE LIKE '93727490%'"
'LINE 98
SQLQuery = "SELECT * FROM CUSTINFO WHERE (PHONE = "& vphone &")"
'LINE 99
Set RsCustomerList = OBJdbConn.Execute(SQLQuery)  
0
Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

 
LVL 23

Expert Comment

by:apresto
ID: 17168593
ok change it to this:

SQLQuery = "SELECT * FROM CUSTINFO WHERE (PHONE = '"& vphone &"')"

and see if it makes a difference
0
 

Author Comment

by:Nmagsaysay
ID: 17169300
That was the trick!! Thanks
0
 
LVL 23

Expert Comment

by:apresto
ID: 17169352
No problem, it was because you were'nt using single quotes in the SQL statement around the variable.  With single quotes means its a text value, without means its numeric - something worth remembering.

Good luck and thanks

Apresto
0

Featured Post

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question