Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1668
  • Last Modified:

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

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
Nmagsaysay
Asked:
Nmagsaysay
  • 3
  • 3
1 Solution
 
NmagsaysayAuthor Commented:
Help any ideas??  
0
 
aprestoCommented:
Hi Nmagsaysay,

Could you point out line 98

Apresto
0
 
NmagsaysayAuthor Commented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
aprestoCommented:
ok change it to this:

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

and see if it makes a difference
0
 
NmagsaysayAuthor Commented:
That was the trick!! Thanks
0
 
aprestoCommented:
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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now