Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2006-07-24
6
Medium Priority
?
1,649 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 2000 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
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 
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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

688 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