Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. error while trying to create a random text display

error while trying to create a random text display

Scheduled Pinned Locked Moved Visual Basic
sysadminhelpquestionlounge
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sukino
    wrote on last edited by
    #1

    somehow.... I receive an error saying that Type mismatch test1.asp, line 11 why is that so???? I had set the Path correct..... table is correct and rs.fields are correct also <% Set conn = Server.CreateObject("ADODB.Connection") DBPath = "Provider=SQLOLEDB;Data Source=SITDB580;....;" conn.Open DBPath Set rsDaten=Server.CreateObject("ADODB.Recordset") strSQL="SELECT * FROM testimonials" rsDaten.Open strSQL,conn,0,3 nTotalRecs = rsDaten(0) if nTotalRecs <> 0 then <======line 11 rsDaten.MoveNext nTotalMax = rsDaten(0) rsDaten.MoveNext nTotalMin = rsDaten(0) end if rsDaten.Close Randomize intChoice = Int((nTotalMax - nTotalMin + 1) * Rnd + nTotalMin) Set rs=Server.CreateObject("ADODB.Recordset") strSQL="SELECT * from testimonials where ID="&intChoice &"" rs.Open strSQL,conn strText=rs.Fields("Text") strAuthor=rs.Fields("Author") if not rs.EOF then %> <%if strAuthor<>"" then %> <%end if %>

    <%=strText %>

    - <%=strAuthor%> -

    <% end if rs.close conn.close %>

    L 1 Reply Last reply
    0
    • S sukino

      somehow.... I receive an error saying that Type mismatch test1.asp, line 11 why is that so???? I had set the Path correct..... table is correct and rs.fields are correct also <% Set conn = Server.CreateObject("ADODB.Connection") DBPath = "Provider=SQLOLEDB;Data Source=SITDB580;....;" conn.Open DBPath Set rsDaten=Server.CreateObject("ADODB.Recordset") strSQL="SELECT * FROM testimonials" rsDaten.Open strSQL,conn,0,3 nTotalRecs = rsDaten(0) if nTotalRecs <> 0 then <======line 11 rsDaten.MoveNext nTotalMax = rsDaten(0) rsDaten.MoveNext nTotalMin = rsDaten(0) end if rsDaten.Close Randomize intChoice = Int((nTotalMax - nTotalMin + 1) * Rnd + nTotalMin) Set rs=Server.CreateObject("ADODB.Recordset") strSQL="SELECT * from testimonials where ID="&intChoice &"" rs.Open strSQL,conn strText=rs.Fields("Text") strAuthor=rs.Fields("Author") if not rs.EOF then %> <%if strAuthor<>"" then %> <%end if %>

      <%=strText %>

      - <%=strAuthor%> -

      <% end if rs.close conn.close %>

      L Offline
      L Offline
      Lasse
      wrote on last edited by
      #2

      It depends on which datatype the field "rsDaten(0)" has.. if its a string or date you can not compare them to 0 ->"nTotalRecs <> 0" Hmm...

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups