If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > "Error converting data type" message

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-10-04, 17:44
Bristow Bristow is offline
Registered User
 
Join Date: Mar 2004
Posts: 2
"Error converting data type" message

I've had a page up and running (ASP with SQL db) that simply lists the music from a television show, with the name of the song, artist and where in the tv show it played. The page has been running with no problems, but I checked it last night and was receiving the following error:


Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC SQL Server Driver][SQL Server]Error converting data type nvarchar to numeric.


I removed bits of code until I found the offending chunk, which I promptly removed. I am absolutely stumped as to what to do. I haven't changed this page in 6 months and my webhost blamed it on a programming error rather than anything they did to my db or tables. Also, I have the exact same code running on other pages (pointing to different tables in the same db) and it works fine....

<% Connection stuff here
WHILE NOT rsMusic.EOF %>
<b><%=rsMusic("SongName")%></b><br>
By: <%=rsMusic("Artist")%><br>
<b>Played while:</b> <%=rsMusic("Played")%>
<p>
<%
rsMusic.MoveNext
WEND
rsMusic.Close
%>

The error keeps pointing to the "rs.Music.MoveNext" line. I have no idea what to do and I'm not a SQL or ASP wiz, so any advice at all would be greatly appreciated.

Thank you all.
Reply With Quote
  #2 (permalink)  
Old 03-10-04, 18:01
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
that is a pretty bizzare error,... the error you are getting is a db erro, but the line you are pointing to doesn't actually appear to affect the database as such. It might have something to do with how you are opening your recordset.

If you post the whole thing I will have a look through and see if I can help.
Reply With Quote
  #3 (permalink)  
Old 03-10-04, 19:16
Bullschmidt Bullschmidt is offline
Guru
 
Join Date: Jun 2003
Location: USA
Posts: 1,032
Or it could have to do with a piece of data in the database - perhaps a field contains some odd character or is unexpectedly blank.
__________________
J. Paul Schmidt, Freelance Web and Database Developer
www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips
Reply With Quote
  #4 (permalink)  
Old 03-10-04, 19:20
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
But if they are reading through the records already in the database then there shouldn't be any link back to the db to produce the error....

I would expect that error to occur when the query is run to get the recordset, not after the recordset is obtained and you are looping through it.
Reply With Quote
  #5 (permalink)  
Old 03-10-04, 19:52
Bristow Bristow is offline
Registered User
 
Join Date: Mar 2004
Posts: 2
Thanks, everyone. I'll check through the fields to make sure there are no strange symbols or are blank -- in the meantime, here is the full snippet (minus my login info!):

<%
varID = Request.QueryString("EpisodeID")
If varID = " " Then
Response.Redirect("index.asp")
End If
%>

<%
SET rsMusic=Server.CreateObject("ADODB.Recordset")
rsMusic.Open "Select * from Music WHERE EpisodeID=" & varID, "DSN=MyDSN;UID=MyID;PWD=MyPassword;"
WHILE NOT rsMusic.EOF %>
<b><%=rsMusic("SongName")%></b><br>
By: <%=rsMusic("Artist")%>
<br><b>Played while:</b> <%=rsMusic("Played")%>
<p>
<%
rsMusic.MoveNext
WEND
rsMusic.Close
%>


It just strikes me as really odd that it just all of a sudden "broke" -- I do add new songs into the table as new episodes air, so I'll check for funky entries - but as I said, I haven't touched this code in months and I have other pages that use almost the identical code (but point to different tables).

Thanks, again!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On