Där du slänger in Request.Querystring("GalleryId") direkt i sql-frågan är något fel med det värdet. Om du skriver ut frågan borde du se vad som är konstigt.
Får detta felet när jag försöker posta kommentar på en bild:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[MySQL][ODBC 3.51 Driver][mysqld-5.0.19-nt]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order by gCommentDate desc' at line 1
/UsrGallery/WriteReadComments.asp, line 35
<!-- #include file="_Inc/Conn.asp" --><!-- #include file="_Inc/Login.asp" --><!-- #include file="_Inc/RegExpGB.asp" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Language" content="sv">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="copyright" content="">
<title></title>
<link rel="stylesheet" href="../_Style/SidansStyle.css" type="text/css">
</head>
<body>
<table cellpadding="0" cellspacing="0" width="705">
<tr>
<td height="5">
<img src="../_Grafik/Profil_Vanster_Uppe.gif" alt="" width="9" height="7"></td>
<td height="7" style="background-image: url('../_Grafik/Profil_Uppe.gif');" width="666"></td>
<td height="5">
<img src="../_Grafik/Profil_Hoger_Uppe.gif" alt="" width="15" height="7"></td>
</tr>
<tr>
<td width="9" style="background-image: url('../_Grafik/Profil_Vanster.gif');" height="525"></td>
<td width="681" height="197" valign="top">
<div style="overflow: auto; width: 656px; height: 380px">
<%
Set ObjRS = ObjConn.Execute("Select * From tblGalleryComments where gCommentPicId="&Request.Querystring("GalleryId")&" order by gCommentDate desc")
Set ObjRS2 = ObjConn.Execute("Select * from TLUSers where UsrId="&SafeSQL(Session("UsrId"))&"")
IF ObjRS.Eof then
Response.Write "<br><br><div align=""center"">Finns inga kommentar</div>"
else
Do until ObjRS.Eof
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="57">
<tr>
<td width="58" height="57" style="padding: 3px;">
<img src="../_Grafik/Pix.gif" width="3" height="20">
<%
Set objBild = objConn.Execute("SELECT UsrPic FROM TLUsers where UsrID="& CLng(ObjRS("gCommentByUserId")) &"")
IF Len(objBild("UsrPic")& "") > 0 then
Response.Write "<img width='40' height='50' src='"& objBild("UsrPic") &"' border='1'>"
else
Response.Write "<img width='40' height='50' src='../_Grafik/ingen_bild.gif' border='1'>"
End if
objBild.Close : Set objBild = Nothing
%><td>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="14">
<tr>
<td width="672" height="14" valign="top" style="padding: 3px;">
<a href="../UsrProfile/Profil.asp?UsrID=<%=Server.HtmlEncode(ObjRS("gCommentByUserId"))%>" target="Start"><%=Server.HtmlEncode(ObjRS("gCommentByUserName"))%></a>
- <span class="Fett_Text">
<%
Dim gCommentDate
gCommentDate = ObjRS("gCommentDate")
Select Case DateDiff("d",gCommentDate,Date())
Case 0
Response.write("<span class=""Fett_Text"">Idag " &left(right(ObjRS("gCommentDate"), 8),5)& "</span>")
Case 1
Response.write("<span class=""Fett_Text"">Igår " &left(right(ObjRS("gCommentDate"), 8),5)& "</span>")
Case Else
Response.write("<span class=""Fett_Text"">"&FormatDateTime(ObjRS("gCommentDate"),vbshortdate)&" "&FormatDateTime(ObjRS("gCommentDate"),vbshorttime)&"</span>")
End Select
%>
</span>
</td>
<td width="307" height="14" valign="top" style="padding: 3px;"><%
If ObjRS2("UsrAdmin")="1" Then
%>
Admin:
<a href="?Delete=ChatPost">Ta bort</a></td>
<%
End If
%> </td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="39">
<tr>
<td width="259" height="39" valign="top" style="padding: 3px;">
<%=byt(ObjRS("gComment"))%>
</td>
</tr>
</table>
</td></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="Profil_Linje_Botten">
<img src="../_Grafik/Pix.gif" width="3" height="3"></td>
</tr>
</table>
<%
ObjRS.MoveNext
Loop
ObjRS.Close : Set ObjRS = nothing
ObjConn.Close : Set ObjConn = nothing
End if
%>
<br>
</div>
<form action="?Write=GalleryComment" method="post">
<div align="center">
<textarea name="GalleryComment" rows="6" cols="113" style="width: 360;height:85;"></textarea>
<input type="hidden" value="<%=CLng(Request.Querystring("GalleryId"))%>" name="gCommentPicId" style="width: 200 px;" readonly>
<input type="submit" name="Submit" value="Skriv kommentar" style="width: 360;height:20">
</div>
</form>
</td>
<td width="15" style="background-image: url('../_Grafik/Profil_Hoger.gif');" height="197"></td>
</tr>
<tr>
<td height="5">
<img src="../_Grafik/Profil_Vanster_Nere.gif" alt="" width="9" height="6"></td>
<td height="5" style="background-image: url('../_Grafik/Profil_Nere.gif');"></td>
<td height="5">
<img src="../_Grafik/Profil_Hoger_Nere.gif" alt="" width="15" height="6"></td>
</tr>
<tr>
<td height="5">
<img src="../_Grafik/Profil2_Vanster_Nere.gif" alt="" width="9" height="16"></td>
<td height="5" style="background-image: url('../_Grafik/Profil2_Nere.gif');"></td>
<td height="5">
<img src="../_Grafik/Profil2_Hoger_Nere.gif" alt="" width="15" height="16"></td>
</tr>
</table>
<%
IF Request.Querystring("Write")="GalleryComment" then
ObjConn.Execute("Insert into tblGalleryComments (gCommentByUserId, gCommentByUserName, gCommentDate, gComment, gCommentPicId) values ("&SafeSQL(Session("UsrID"))&",'"&SafeSQL(Session("UsrTLAlias"))&"','" & now & "','"&SafeSQL(Request.Form("GalleryComment"))&"','"&SafeSQL(Request.Form("gCommentPicId"))&"')")
ObjConn.Close : Set ObjConn = Nothing
Response.Redirect(Request.ServerVariables("HTTP_REFERER"))
End if
%>
</body>
</html>
