Avatar billede andersasp Nybegynder
21. juni 2004 - 22:18 Der er 4 kommentarer og
1 løsning

Gemmer samme data i insert into!

Hejsa eksperter!

Jeg har et script som gemmer noget data som kommer fra en form! Den gemmer også helt fint første gang, men anden gang man gemmer smider den det samme data ind som man skrev første gang - det er ligesom om at den helt smider de nye form data væk???????

Hvad kan problemet være????

<%

Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Open MM_multiforum_STRING
   
'Erkl&aelig;rer variabler
FRauthor = Request.form("FRauthor")
FRtopickey = Request.form("FRtopickey")
FRcatkey = Request.form("FRcatkey")
FRdate = Request.form("FRdate")
Ktexts = Request.form("Ktexts")
Ktexts = Replace(Ktexts, "'", "''")

    strSql= "INSERT INTO forumreply (FRauthor, FRtopickey, FRcatkey, FRdate, FRDescription) VALUES ('" & FRauthor & "', '" & FRtopickey & "', '" & FRcatkey & "', '" & FRdate & "', '" & Ktexts & "')"

  Conn.Execute(strSql)  'linie 24
    Conn.Close
    response.redirect("showtopic.asp?FTID=" & Request.Form("FTID") & "")

%>
Avatar billede ellebaek Nybegynder
21. juni 2004 - 22:22 #1
hmm...

Hvordan ser din form ud..?
Avatar billede andersasp Nybegynder
21. juni 2004 - 22:37 #2
Den er lidt lang men her er den:D

<form action="insertpage.asp" name="form1" method="post" onSubmit="return flytIndhold();MM_validateForm('FTHEadline','','R');return document.MM_returnValue">
  <table width="422" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td width="76%" align="right" valign="top" nowrap><div align="left">          <table id="tblCoolbar" width="100%" cellpadding="0" cellspacing="0">
                <tr valign="middle">
            <td colspan="16">                    <p>
                      <strong>User: </strong><%=(forumuser.Fields.Item("Uusername").Value)%> <strong>Category:</strong>
                      <%=(forumcategory.Fields.Item("FCheadline").Value)%>                  </p>
                    <p><strong>Headline</strong>
                      <input type="hidden" name="Ktexts">
                      <br>
                      <input name="FTHEadline" type="text" id="FTHEadline" value="Topic by <%=(forumuser.Fields.Item("Uusername").Value)%>" size="50">
                      <br>
                      <br>
                      <select name="select" onChange="cmdExec('fontname',this[this.selectedIndex].value);">
                        <option selected>Font</option>
                        <option value="Arial">Arial</option>
                        <option value="Arial Black">Arial Black</option>
                        <option value="Arial Narrow">Arial Narrow</option>
                        <option value="Comic Sans MS">Comic Sans MS</option>
                        <option value="Courier New">Courier New</option>
                        <option value="System">System</option>
                        <option value="Tahoma">Tahoma</option>
                        <option value="Times New Roman">Times New Roman</option>
                        <option value="Verdana">Verdana</option>
                        <option value="Wingdings">Wingdings</option>
                      </select>
                      <select name="select" onChange="cmdExec('fontsize',this[this.selectedIndex].value);">
                        <option selected>Size</option>
                        <option value="1">1</option>
                        <option value="2">2</option>
                        <option value="3">3</option>
                        <option value="4">4</option>
                        <option value="5">5</option>
                        <option value="6">6</option>
                        <option value="7">7</option>
                        <option value="8">8</option>
                        <option value="10">10</option>
                        <option value="12">12</option>
                        <option value="14">14</option>
                      </select>
<br>
                </p></td>
                </tr>
                <tr bgcolor="#CCCCCC">
                  <td style="border-left-style: solid; border-left-width: 1; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#000000"><div class="cbtn" onClick="cmdExec('cut')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);"> <img hspace="1" vspace="1" align="absmiddle" src="images/Cut.gif" alt="Cut" WIDTH="23" HEIGHT="22"> </div></td>
                  <td style="border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#000000"><div class="cbtn" onClick="cmdExec('copy')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);"> <img hspace="1" vspace="1" align="absmiddle" src="images/Copy.gif" alt="Copy" WIDTH="23" HEIGHT="22"> </div></td>
                  <td style="border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#000000"><div class="cbtn" onClick="cmdExec('paste')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);"> <img hspace="1" vspace="1" align="absmiddle" src="images/Paste.gif" alt="Paste" WIDTH="23" HEIGHT="22"> </div></td>
                  <td style="border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#000000"><div class="cbtn" onClick="cmdExec('bold')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);"> <img hspace="1" vspace="1" align="absmiddle" src="images/Bold.gif" alt="Bold" WIDTH="23" HEIGHT="22"> </div></td>
                  <td style="border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#000000"><div class="cbtn" onClick="cmdExec('italic')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);"> <img hspace="1" vspace="1" align="absmiddle" src="images/Italic.gif" alt="Italic" WIDTH="23" HEIGHT="22"> </div></td>
                  <td style="border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#000000"><div class="cbtn" onClick="cmdExec('underline')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);"> <img hspace="1" vspace="1" align="absmiddle" src="images/Under.gif" alt="Underline" WIDTH="23" HEIGHT="22"> </div></td>
                  <td style="border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#000000"><div class="cbtn" onClick="cmdExec('justifyleft')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);"> <img hspace="1" vspace="1" align="absmiddle" src="images/Left.gif" alt="Justify Left" WIDTH="23" HEIGHT="22"> </div></td>
                  <td style="border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#000000"><div class="cbtn" onClick="cmdExec('justifycenter')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);"> <img hspace="1" vspace="1" align="absmiddle" src="images/Center.gif" alt="Center" WIDTH="23" HEIGHT="22"> </div></td>
                  <td style="border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#000000"><div class="cbtn" onClick="cmdExec('justifyright')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);"> <img hspace="1" vspace="1" align="absmiddle" src="images/Right.gif" alt="Justify Right" WIDTH="23" HEIGHT="22"> </div></td>
                  <td style="border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#000000"><div class="cbtn" onClick="cmdExec('insertorderedlist')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);"> <img hspace="2" vspace="1" align="absmiddle" src="images/numlist.GIF" alt="Ordered List" WIDTH="23" HEIGHT="22"> </div></td>
                  <td style="border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#000000"><div class="cbtn" onClick="cmdExec('insertunorderedlist')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);"> <img hspace="2" vspace="1" align="absmiddle" src="images/bullist.GIF" alt="Unordered List" WIDTH="23" HEIGHT="22"> </div></td>
                  <td style="border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#000000"><div class="cbtn" onClick="cmdExec('outdent')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);"> <img hspace="2" vspace="1" align="absmiddle" src="images/deindent.gif" alt="Decrease Indent" WIDTH="23" HEIGHT="22"> </div></td>
                  <td style="border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#000000"><div class="cbtn" onClick="cmdExec('indent')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);"> <img hspace="2" vspace="1" align="absmiddle" src="images/inindent.gif" alt="Increase Indent" WIDTH="23" HEIGHT="22"> </div></td>
                  <td style="border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#000000"><div class="cbtn" onClick="foreColor()" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);"> <img hspace="2" vspace="1" align="absmiddle" src="images/fgcolor.gif" alt="Forecolor" WIDTH="23" HEIGHT="22"> </div></td>
                  <td style="border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#000000"><div class="cbtn" onClick="cmdExec('createLink')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);"> <img hspace="2" vspace="1" align="absmiddle" src="images/Link.gif" alt="Link" WIDTH="23" HEIGHT="22"> </div></td>
                  <td style="border-right-style: solid; border-right-width: 1; border-top-style: solid; border-top-width: 1; border-bottom-style: solid; border-bottom-width: 1" bordercolor="#000000"><div class="cbtn" onClick="insertImage()" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);"> <img hspace="2" vspace="1" align="absmiddle" src="images/Image.gif" alt="Image" WIDTH="23" HEIGHT="22"> </div></td>
                  <td width="20" bgcolor="#FFFFFF" style="border-left-style: solid; border-left-width: 1">&nbsp;</td>
                </tr>
              </table>
              <iframe width="450" id="idContent" height="295" marginwidth="4" marginheight="4"></iframe>
              <br>
              <input name="checkbox" type="checkbox" onclick="setMode(this.checked)" value="ON">
          Edit HTML<br>
          <script>
        idContent.document.write ("<style>body{font-family:verdana; font-size: 10px;}</style>")
        //idContent.document.body.innerHTML =
        idContent.document.close()

        </script>
          <br>
      </div></td>
    </tr>
    <tr valign="baseline">
      <td align="right" nowrap><div align="left"> </div>
       
          <div align="right">
              <input name="FRauthor" type="hidden" id="FRauthor" value="<%=(forumuser.Fields.Item("Uusername").Value)%>">
              <input name="FRcatkey" type="hidden" id="FRcatkey" value="<%=(forumcategory.Fields.Item("FCID").Value)%>">
              <input name="FRdate" type="hidden" id="FRdate" value="<%=now()%>">
            <input name="submit" type="submit" value="Add new topic">
        </div></td>
    </tr>
    <tr valign="baseline">
      <td align="right" nowrap>          <br>
          <span class="style2"><br>
        *</span> Do not save in HTML mode </td></tr>
  </table>
</form>
Avatar billede andersasp Nybegynder
21. juni 2004 - 22:56 #3
Sorry! det var mig der var dum! jeg havde lavet en fejl i min repeat!!  hvis du vil have nogle points for at prøve må du lige smide et svar! :D
Avatar billede ellebaek Nybegynder
21. juni 2004 - 22:59 #4
det var jo ikke rigtig et forsøg jeg lavede ;-)
Så ingen points til mig...
Avatar billede andersasp Nybegynder
22. juni 2004 - 07:01 #5
Ok tak alligevel! jeg skal prøve ikke at være så hurtig på tasterne næste gang:D
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester