Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Posts
    2

    Unanswered: "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.

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    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.

  3. #3
    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

  4. #4
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    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.

  5. #5
    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •