Visualizzazione dei risultati da 1 a 3 su 3

Discussione: Type Mismatch!?!?

  1. #1
    Utente di HTML.it L'avatar di Bioboi
    Registrato dal
    Nov 1999
    Messaggi
    110

    Type Mismatch!?!?

    Ringrazio tutti quelli che generosissimamente mi aiutano.
    Ora ottengo un errore da questo codice, alla riga 67 (da me evidenziata). L'errore è il seguente:

    Type mismatch
    /editpost.asp, line 67
    codice:
    <%@LANGUAGE = "VBSCRIPT" %>
    <%Option Explicit%>
    
    <%
    Dim rs, strSQL, postTitle, postText, postPublished, postID, nopost, isError
    
    if Request.Form("btnPost") > "" Then
    	postTitle = Replace(Request.Form("postTitle"), "'", "''")
    	postText = Replace(Request.Form("postText"), "'", "''")
    	postID = Request.Form("postID")
    	
    if Request.Form("postPublished") = 1 then
    		postPublished = 1
    	else
    		postPublished = 0
    	end if
    	
    if postTitle > "" and postText > "" Then
    					strSQL = "UPDATE tblPosts SET postTitle = '" & postTitle & "', postText = '" & postText & "', postPublished = " & postPublished & " WHERE postID = " & postID
    										
    					conn.execute(strSQL)
    					
    					response.redirect "entries.asp?edit=true"
    else
    
    			isError=true
    	end if
    	
    else
    
    		postID = Request.QueryString("postID")
    		set rs = Server.CreateObject("ADODB.Recordset")
    		strSQL = "SELECT * FROM tblPosts WHERE postID = " & postID
    		rs.open strSQL, conn
    		if not rs.EOF then
    				postTitle= rs("postTitle")
    				postText= rs("postText")
    				postPublished= rs("postPublished")
    		else
    				nopost = true
    		end if
    		rs.close
    		set rs = nothing
    end if %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Blog Admin: edit a post</title>
    <link href="stilemarghbis.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <div id="content">
      <% if not nopost = true then %>
      <% if isError = true then %>
      <p class="error">You must give your blog post a title and complete the entry
        to submit the form</p>
      <% else %>
      
    
    Edit your post</p>
      <% end if %>
      <form method="post" action="editpost.asp">
        
    
    
          <label for="postTitle">Title:</label>
          <% if isError = true and postTitle="" then %>
          <span class="error">Please add a title
          <% end if %>
          
    
          <input type="text" name="postTitle" value="<% postTitle %>" />     
        </p>
        
    
    
          <label for="postText">Your entry:</label>
          <% if isError=true and postText="" then %>
          <span class ="error">Please add your entry
          <%end if%>
          
    
          <textarea name= "postText" id="postText" class="txtlarge" cols="40" rows = "10" ><% = postText %>
    </textarea>
        </p>
        
    
    
          <label for ="postPublished">Publish?</label>
          <input type="checkbox" name="postPublished"
    id= "postPublished" value="1" <% if postPublished =true then %>checked = "checked"<% end if %> />
        </p>
        
    
    
          <input type="hidden" name ="postID" id="postID" value =" <% postID %>" />
          <input type="submit" name="btnPost" id="btnPost" value="edit Entry" />
        </p>
      </form>
      <% end if
    set conn = nothing
    %>
    </div>
    </body>
    </html>

  2. #2
    Utente di HTML.it L'avatar di agenti
    Registrato dal
    Feb 2002
    Messaggi
    2,427
    usa il response write

    <input type="text" name="postTitle" value="<%=postTitle%>" />

  3. #3
    Utente di HTML.it L'avatar di Bioboi
    Registrato dal
    Nov 1999
    Messaggi
    110
    Grazie! E chiedo scusa per l'errore banale...!!!

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.