Fejl i SQL...
Får denne fejl:The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data in the field or fields that contain duplicate data, remove the index, or redefine the index to permit duplicate entries and try again
Med denne kode:
<table width="100%" style="border-collapse: collapse" bordercolor="#111111" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" align="right">
<p>
<form name="creator" method="post" action="creator.asp">
<font color="#333333"><b>Creators:</b></font>
<select name="creator">
<%
Set Conn = Server.CreateObject("ADODB.Connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.MapPath("dco_database.mdb")
Conn.Open DSN
strSQL = "SELECT DISTINCT tegner FROM comics ORDER BY tegner"
Set rs = Conn.Execute(strSQL)
Do
strCreator = rs("tegner")
strTegner = strCreator
If strTegner = "dr" Then
strTegner = "Don Rosa"
End if
If strTegner = "cb" Then
strTegner = "Carl Barks"
End if
%>
<option value="<%=strCreator%>"><%=strTegner%></option>
<%
rs.movenext
Loop While Not rs.EOF
rs.Close
Set rs = Nothing
Conn.Close
Set Conn = Nothing
%>
</select>
<input type="submit" value="Show me!"><br>
</form>
</p>
<p>
<form name="character" method="post" action="character.asp">
<font color="#333333"><b>Characters:</b></font>
<select name="character">
<%
Set Conn = Server.CreateObject("ADODB.Connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.MapPath("dco_database.mdb")
Conn.Open DSN
strSQL = "SELECT DISTINCT hovedperson FROM comics"
Set rs = Conn.Execute(strSQL)
Do
strApp = rs("hovedperson")
strHovedperson = strApp
If strHovedperson = "dd" Then
strHovedperson = "Donald Duck"
End if
If strHovedperson = "us" Then
strHovedperson = "Uncle Scrooge"
End if
%>
<option value="<%=strApp%>"><%=strHovedperson%></option>
<%
rs.movenext
Loop While Not rs.EOF
rs.Close
Set rs = Nothing
Conn.Close
Set Conn = Nothing
%>
</select>
<input type="submit" value="Show me!"><br>
</form>
</p>
</td>
</tr>
</table>
Hvori ligger fejlen?
