Avatar billede babyworm Nybegynder
11. februar 2005 - 07:59 Der er 1 kommentar og
1 løsning

Underlige fejl i UPDATE sætning

Hej..

Jeg får denne fejl når jeg prøver at update min base:

Fejltype:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access-driver] Outputdestinationen "email" er dubleret.
/page/401.asp, line 30



Min kode:
<!--#include virtual="/_inc/dbconn.asp"-->
<!--#include virtual="/_inc/userpage_protect.asp"-->

      <h1>Rediger min profil</h1>
<%
openConn()

strCmd = Request.Querystring("cmd")
If strCmd = "update" Then

    strID        = Request.Form("id")
    strUsername     = Replace(Request.Form("username"),"'","´")
    strPassword     = Replace(Request.Form("password"),"'","´")
    strName     = Replace(Request.Form("name"),"'","´")
    strAge         = Replace(Request.Form("age"),"'","´")
    strAdress     = Replace(Request.Form("adress"),"'","´")
    strZip         = Replace(Request.Form("zip"),"'","´")
    strCity        = Replace(Request.Form("city"),"'","´")
    strPhone    = Replace(Request.Form("phone"),"'","´")
    strMobile    = Replace(Request.Form("mobile"),"'","´")
    strEmail    = Replace(Request.Form("email"),"'","´")
    strHomepage    = Replace(Request.Form("homepage"),"'","´")
    strMessenger    = Replace(Request.Form("messenger"),"'","´")
    strContext    = Replace(Request.Form("context"),"'","´")
    strContext    = Replace(strContext,"vbCrLf","<br>")

    strSQL = "UPDATE user SET username='" & strUsername & "',password='" & strPassword & "' WHERE user.id=" & strID
    Set rs = connection.Execute(strSQL)
    strSQL1 = "UPDATE user_profile SET [name]='" & strName & "',[age]='" & strAge & "',[adress]='" & strAdress & "',[zip]='" & strZip & "',[city]='" & strCity & "',[phone]='" & strPhone & "',[mobile]='" & strMobile & "',[email]='" & strEmail & "',[homepage]='" & strHomepage & "',[email]='" & strEmail & "',[messenger]='" & strMessenger & "',[context]='" & strContext & "'"
    Set rs1 = connection.Execute(strSQL1)
    'Response.Write(strSQL)

Else

strID = Session("userid")

If strID = "" Then
    Response.Write("Der er sket en fejl! Prøv og log ind igen.")
Else

strSQL = "SELECT user.username,user.password,user.type,user_type.id,user_type.type as usertype,user_profile.name,user_profile.age,user_profile.adress,user_profile.zip,user_profile.city,user_profile.phone,user_profile.mobile,user_profile.email,user_profile.homepage,user_profile.messenger,user_profile.context FROM user,user_type,user_profile WHERE user.id=" & strID & " AND user.type=user_type.id AND user_profile.id=user.id"
set rs = connection.Execute(strSQL)

If Not (rs.EOF or rs.BOF) Then
%>
<form method="post" action="/default.asp?pID=401&cmd=update" name="update">
<table border="0" cellpadding="0" cellspacing="0" style="width:300px;">
<tr>
  <td style="width:100px;"><b>Brugernavn:</b></td>
  <td style="width:200px;height:20px;"><input type="text" name="username" value="<%=rs("username")%>" class="input"></td>
</tr>
<tr>
  <td><b>Adgangskode:</b></td>
  <td style="height:20px;"><input type="text" name="password" value="<%=rs("password")%>" class="input"></td>
</tr>
<tr>
  <td><b>Brugertype:</b></td>
  <td style="height:20px;"><%=rs("usertype")%></td>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr>
  <td><b>Navn:</b></td>
  <td style="height:20px;"><input type="text" name="name" value="<%=rs("name")%>" class="input"></td>
</tr>
<tr>
  <td><b>Alder:</b></td>
  <td style="height:20px;"><input type="text" name="age" value="<%=rs("age")%>" class="input"></td>
</tr>
<tr>
  <td><b>Adresse:</b></td>
  <td style="height:20px;"><input type="text" name="adress" value="<%=rs("adress")%>" class="input"></td>
</tr>
<tr>
  <td><b>Postnr. & by:</b></td>
  <td style="height:20px;"><input type="text" name="zip" value="<%=rs("zip")%>" style="width:40px;" class="input">&nbsp;<input type="text" name="city" value="<%=rs("city")%>" style="width:92px;" class="input"></td>
</tr>
<tr>
  <td><b>Telefon:</b></td>
  <td style="height:20px;"><input type="text" name="phone" value="<%=rs("phone")%>" class="input"></td>
</tr>
<tr>
  <td><b>Mobil:</b></td>
  <td style="height:20px;"><input type="text" name="mobile" value="<%=rs("mobile")%>" class="input"></td>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr>
  <td colspan="2">
  <table border="0" cellpadding="5" cellspacing="0" style="width:100%;" class="input">
    <tr>
    <td style="width:30px;text-align:center;"><img src="/gfx/mail.gif" alt="<%If IsNull(rs("email"))=True Then%><%Else%>E-mailadresse: <%=rs("email")%><%End if%>" width="13" height="11" border="0"></td>
    <td style="padding-left:5px;height:20px;"><input type="text" name="email" value="<%=rs("email")%>" class="input" style="background-color:#ffffff;"></td>
    </tr>
    <tr>
    <td style="width:30px;text-align:center;"><img src="/gfx/www.gif" alt="<%If IsNull(rs("homepage"))=True Then%><%Else%>Hjemmeside: <%=rs("homepage")%><%End if%>" width="16" height="16" border="0"></td>
    <td style="padding-left:5px;height:20px;"><input type="text" name="homepage" value="<%=rs("homepage")%>" class="input" style="background-color:#ffffff;"></td>
    </tr>
    <tr>
    <td style="width:30px;text-align:center;"><img src="/gfx/messenger.gif" alt="<%If IsNull(rs("adress"))=True Then%><%Else%>Messengeradresse: <%=rs("messenger")%><%End if%>" width="16" height="16" border="0"></td>
    <td style="padding-left:5px;height:20px;"><input type="text" name="messenger" value="<%=rs("messenger")%>" class="input" style="background-color:#ffffff;"></td>
    </tr>
  </table>
  </td>
</tr>
<tr><td colspan="2">&nbsp;</td></tr>
<tr>
  <td colspan="2"><b>Profiltekst:</b></td>
</tr>
<tr><td colspan="2">
<textarea style="width:100%;height:53px;" name="context"><%=rs("context")%></textarea><input type="hidden" name="id" value="<%=rs("id")%>"></td></tr>
</table>

<br>   
<hr class="point">
<div align="right"><a href="java script:document.update.submit();" class="navigate">gem profil</a> - <a href="#" class="navigate">slet profil</a></div>
</form>
<%
End if
closeConn()
End if
End if
%>
Avatar billede babyworm Nybegynder
11. februar 2005 - 08:03 #1
Jeg fandt lige en fejl.. Havde glemt en WHERE i min strSQL1.. men det hjalp ikke..
Avatar billede babyworm Nybegynder
11. februar 2005 - 08:03 #2
UPS... email er skrevet to gange
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