Hmm - umiddelbart formatterer mckkellys svar SQLen rigtigt, men fejlmeddelelsen er stadigvæk den samme:
[Microsoft][ODBC Microsoft Access-driver] Datatyperne stemmer ikke overens i kriterieudtrykket.
/menu/tools/news/newsAddArticle.asp, line 58
Kan det være noget andet??? Her er koden:
Siden findes på "greenguides.dk/menu/tools_dk.asp" og "Nyheder", "Tilføj Nyhedsartikel", "Send"
---------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<TITLE>Oversigt over artikler</TITLE>
<META name=description content="Viser nyhedsartikler">
<LINK rel="stylesheet" href="../../../common/styles.css">
</HEAD>
<!-- <BODY onLoad="parent.Fasttop.location.href='newsFastTop_dk.asp'"> -->
<!-- hvorfor daelen virker body onLoad ikke i IE5? -->
<BODY>
<%
' Fix fjerner apostroffer - bemaerk: SQL kan blot laves med dobbelte ", saa er problemet loest uden fix
function Fix(mInString)
fix = replace(mInString, "'", "''")
end function
mBaseDir = request.form ("mBaseDir")
mNewsReaderPage = request.form("mNewsReaderPage")
mSubmitted = request.form("mSubmitted")
mTitle = fix(request.form("mTitle"))
mBody = fix(request.form("mBody"))
mURL = fix(request.form("mURL"))
' Vi vil ikke have HTTP med i URLen. Fjernes ved at klippe fra hoejre
IF left(mURL, 7) = "
http://" THEN mURL = right(mURL, len(mURL)-7)
' Check om mTitle, mBody, og mURL er gyldige - lige nu bare om de ikke er tomme!
IF mTitle <> "" AND mBody <> "" AND mURL <> "" THEN
' INSERT data i database
set connNews = server.createobject("ADODB.Connection")
connNews.Open "DBQ="&Request.ServerVariables("APPL_PHYSICAL_PATH")& mBaseDir &"\news.mdb;DefaultDir="&Request.ServerVariables("APPL_PHYSICAL_PATH")&" mBaseDir;Driver={Microsoft Access Driver (*.mdb)};"
'set rsArticles = connNews.Execute("INSERT into Article ( Art_Date, Art_Title, Art_Body, Art_URL, Art_Live ) SELECT #" & Date() & "# as mDate, '" & mTitle & "' as Title, '" & mBody & "' as Body, '" & mURL & "' as URL, " & True & " as Live;")
SQL="INSERT into Article ( Art_Date, Art_Title, Art_Body, Art_URL, Art_Live ) SELECT #" & Date() & "# as mDate, '" & mTitle & "' as Title, '" & mBody & "' as Body, '" & mURL & "' as URL, 'True' as Live;"
' response.write sql
set rsArticles = connNews.Execute(SQL)
'set rsArticles = connNews.Execute("INSERT into Article ( Art_Date, Art_Title, Art_Body, Art_URL, Art_Live ) SELECT #" & Date() & "# as mDate, '" & mTitle & "' as Title, '" & mBody & "' as Body, '" & mURL & "' as URL, " & True & " as Live;")
'Vis det indsendte til afsenderen - (HTML formatteres rigtigt)
%>
<!-- Her starter et logoscript i nederste højre hjørne-->
<SCRIPT language=JAVASCRIPT src="../../../common/staticlogo_dk.js"></SCRIPT>
<!-- Her slutter logoscriptet-->
<DIV id="TakOverskrift" style="position: absolute; left: 13px; top: 5px; width: 509px; height: 50px; z-index: 8; text-align: left; visibility: visible">
<DIV align="center" class="Overskrift1">Tak for din artikel<BR><SPAN class broed-alm>Sådan ser den ud</SPAN> </DIV>
</DIV>
<DIV id="Taktekst" style="position: absolute; left: 37px; top: 57px; width: 434px; height: 410px; z-index: 9; text-align: left; visibility: visible">
<TABLE><TR><TD><A href =
http://<%= murl%> class="Broed-lilleSort"> <%=mTitle%> </A> - <I class="Broed-lilleSort"><%=date%> </I></TD></TR>
<TR class="Broed-lille"><TD><%=mBody%></TD></TR></TABLE><P>
<FORM action="<%= mNewsReaderPage %>" method="POST">
<INPUT type=SUBMIT name="<< Tilbage til Nyheder"" VALUE="<< Tilbage til Nyheder"">
</FORM>
</DIV>
<%
response.end
ELSE
' Dataene var ikke korrekte (dvs udfyldt forkert eller formularen ikke vist endnu)
IF mSubmitted = "True" then
response.write "<P>Du skal udfylde alle felter i formularen.<P>"
ELSE
%>
<!-- Her starter et logoscript i nederste højre hjørne-->
<SCRIPT language=JAVASCRIPT src="../../../common/staticlogo_dk.js"></SCRIPT>
<!-- Her slutter logoscriptet-->
<DIV id="Overskrift" style="position: absolute; left: 13px; top: 5px; width: 509px; height: 50px; z-index: 8; text-align: left; visibility: visible">
<DIV align="center" class="Overskrift1"> Her er en god grøn artikel</DIV>
</DIV>
<DIV id="Oversigten" style="position: absolute; left: 37px; top: 57px; width: 434px; height: 410px; z-index: 9; text-align: left; visibility: visible">
<TABLE id= Yderstetabel border=0 cellspacing=0 cellpadding=0 nof=LY width="425">
<TR valign=TOP align=LEFT>
<TD width=525>
<TABLE id="2yderste" border=5 cellspacing=3 cellpadding=1 width=422>
<TR bgcolor="#FFCC00">
<TD width=556 height=360>
<P>
<TABLE id="3tabel" width=397 border=0 cellspacing=0 cellpadding=0 align=LEFT nof=TE vspace="0" hspace="0">
<TR>
<TD>
<TABLE id="4tabel" border=0 cellspacing=0 cellpadding=0 width=378 height=360 nof="LayoutRegion1" bgcolor="#FFCC00">
<TR align=LEFT valign=TOP>
<TD>
<FORM action="" method=POST>
<INPUT type=HIDDEN name="mSubmitted" value="True" class="Broed-mini">
<INPUT type=HIDDEN name="mBaseDir" value = "<%= mBaseDir %>" class="Broed-mini">
<INPUT type=HIDDEN name="mNewsReaderPage" value = "<%= mNewsReaderPage %>" class="Broed-mini">
<TABLE id="5tabel" cellpadding=0 cellspacing=0 width=420>
<TR valign=TOP align=LEFT>
<TD width="72">
<TABLE id="Nummertabel" border=0 cellspacing=0 cellpadding=0 width=58 nof="LayoutRegion1">
<TR valign=TOP align=LEFT>
<TD width=12 height=12><IMG src="../../../images/dot_clear.gif" width=12 height=5 border=0></TD>
<TD width=11><IMG src="../../../images/dot_clear.gif" width=1 height=5 border=0 alt=""></TD>
<TD width=1><IMG src="../../../images/dot_clear.gif" width=1 height=5 border=0></TD>
<TD width=3><IMG src="../../../images/dot_clear.gif" width=3 height=5 border=0></TD>
<TD width=26><IMG src="../../../images/dot_clear.gif" width=26 height=5 border=0></TD>
<TD width=1><IMG src="../../../images/dot_clear.gif" width=1 height=5 border=0></TD>
<TD width=1><IMG src="../../../images/dot_clear.gif" width=1 height=5 border=0></TD>
<TD width=2><IMG src="../../../images/dot_clear.gif" width=2 height=5 border=0></TD>
<TD width=1><IMG src="../../../images/dot_clear.gif" width=1 height=5 border=0></TD>
</TR>
<TR valign=TOP align=LEFT>
<TD colspan=4></TD>
<TD width=31 colspan=5>
<P class="Overskrift3Sort"> <FONT color="#CC0000">1.</FONT>
</TD>
</TR>
<TR valign=TOP align=LEFT>
<TD colspan=9 height=24></TD>
</TR>
<TR valign=TOP align=LEFT>
<TD colspan=2></TD>
<TD width=31 colspan=4>
<P class="Overskrift3Sort"><FONT color="#CC0000">2.</FONT>
</TD>
<TD colspan=3></TD>
</TR>
<TR valign=TOP align=LEFT>
<TD colspan=9 height=25></TD>
</TR>
<TR valign=TOP align=LEFT>
<TD colspan=3></TD>
<TD width=31 colspan=4>
<P class="Overskrift3Sort"><FONT color="#CC0000">3.</FONT>
</TD>
<TD colspan=2></TD>
</TR>
<TR valign=TOP align=LEFT>
<TD colspan=9 height=39></TD>
</TR>
<TR valign=TOP align=LEFT>
<TD height=3></TD>
<TD width=45 colspan=7></TD>
<TD></TD>
</TR>
<TR valign=TOP align=LEFT>
<TD colspan=9 height=3></TD>
</TR>
<TR valign=TOP align=LEFT>
<TD width=53 colspan=5></TD>
<TD colspan=4></TD>
</TR>
</TABLE>
</TD>
<TD width="371">
<TABLE border=0 cellspacing=0 cellpadding=0 width=291 nof="LayoutRegion1" height="350">
<TR valign=TOP align=LEFT>
<TD width=2 height=13><IMG src="../../../images/dot_clear.gif" width=2 height=5 border=0></TD>
<TD width=1><IMG src="../../../images/dot_clear.gif" width=1 height=5 border=0></TD>
<TD width=1><IMG src="../../../images/dot_clear.gif" width=1 height=5 border=0></TD>
<TD width=174><IMG src="../../../images/dot_clear.gif" width=174 height=5 border=0></TD>
<TD width=102><IMG src="../../../images/dot_clear.gif" width=102 height=5 border=0></TD>
<TD width=40><IMG src="../../../images/dot_clear.gif" width=40 height=5 border=0></TD>
<TD width=25><IMG src="../../../images/dot_clear.gif" width=25 height=5 border=0></TD>
<TD width=1><IMG src="../../../images/dot_clear.gif" width=1 height=5 border=0></TD>
<TD width=3><IMG src="../../../images/dot_clear.gif" width=2 height=5 border=0></TD>
<TD width=2><IMG src="../../../images/dot_clear.gif" width=1 height=5 border=0></TD>
<TD width=6><IMG src="../../../images/dot_clear.gif" width=6 height=5 border=0></TD>
</TR>
<TR valign=TOP align=LEFT>
<TD colspan=3></TD>
<TD width=174>
<P class="Broed-lilleSort">Skriv titlen
på din artikel
</TD>
<TD colspan=7></TD>
</TR>
<TR valign=TOP align=LEFT>
<TD colspan=11 height=4></TD>
</TR>
<TR valign=TOP align=LEFT>
<TD colspan=2 height=22></TD>
<TD colspan=8>
<INPUT id="FormsEditField1" type=TEXT name="mTitle" value="Sidste og nyeste påfund" size=52 maxlength=52 class="Broed-lille">
</TD>
<TD width="6"></TD>
</TR>
<TR valign=TOP align=LEFT>
<TD colspan=11 height=25></TD>
</TR>
<TR valign=TOP align=LEFT>
<TD width="2"></TD>
<TD colspan=10>
<P class="Broed-lilleSort">Internetadresse
på det site, hvor du fandt nyheden
</TD>
</TR>
<TR valign=TOP align=LEFT>
<TD colspan=11 height=4></TD>
</TR>
<TR valign=TOP align=LEFT>
<TD height=22 width="2"></TD>
<TD colspan=8>
<INPUT id="FormsEditField2" type=TEXT name="mURL" value="greenguides.dk" size=52 maxlength=52 class="Broed-lille">
</TD>
<TD colspan=2></TD>
</TR>
<TR valign=TOP align=LEFT>
<TD colspan=11 height=25></TD>
</TR>
<TR valign=TOP align=LEFT>
<TD colspan=6>
<P class="Broed-lilleSort">Hvad handler
nyhedsartiklen om?<BR>
min. <FONT color="#FFFFFF">150</FONT>
bogstaver)
</TD>
<TD colspan=5></TD>
</TR>
<TR valign=TOP align=LEFT>
<TD colspan=11 height=2></TD>
</TR>
<TR valign=TOP align=LEFT>
<TD height=150 colspan=8>
<TEXTAREA wrap=PHYSICAL id="FormsMultiLine1" name="mBody" rows=9 cols=50 class="Broed-lille">1-50 bogstaver
51-100 bogstaver
101-150 bogstaver
</TEXTAREA>
</TD>
<TD colspan=3></TD>
</TR>
<TR valign=TOP align=LEFT>
<TD colspan=11 height=5></TD>
</TR>
<TR valign=TOP align=LEFT>
<TD height=24 width="2"></TD>
<TD height=24 width="1"></TD>
<TD height=24 width="1"></TD>
<TD height=24 width="174"></TD>
<TD colspan=3 height=24>
<INPUT type=SUBMIT name="FormsButton1" value="Send artikel !" id="FormsButton1" class="Broed-lilleSort">
</TD>
<TD colspan=4></TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</FORM>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</DIV>
<%
END IF
END IF
'* Luk forbindelsen for at undgå memory leaks *'
set connNews = nothing
%>
--------------------------