Avatar billede EIHP Juniormester
25. januar 2007 - 21:24 Der er 5 kommentarer og
1 løsning

asp fejl: 80040e09

Microsoft OLE DB Provider for ODBC Drivers error '80040e09'

[MySQL][ODBC 3.51 Driver][mysqld-4.1.21-log]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 '[Class], [Level], [Ra(

/test/read.asp, line 173

read.asp:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<table width="800" border="1" cellspacing="0" cellpadding="0">
  <tr>
    <td width="100">Nr.</td>
    <td width="100">Character</td>
    <td width="100">Level</td>
    <td width="100">Class</td>
    <td width="100">Rank</td>
    <td width="100">Note</td>
    <td width="100">Officer-note</td>
    <td width="100">Opdateret</td>
  </tr>
<%
regFindOutAcadamy = request("acadamy")
if regFindOutAcadamy = 1 then
strFindOutAcadamy = 1
else
strFindOutAcadamy = 0
end if

strConnDSN = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("/dbpath/db.mdb")
Set GuildList_Conn = Server.CreateObject("ADODB.Connection")
GuildList_Conn.Open session("DSN")

strGuildDelete_SQL = "Update `Character` set CheckforDelete = 1 where Acadamy = " & strFindOutAcadamy
response.write strGuildDelete_SQL & "<br>"
GuildList_Conn.execute(strGuildDelete_SQL)

Dim fso, f, filespec
Set fso = CreateObject("Scripting.FileSystemObject")
if strFindOutAcadamy = 0 then
filespec = Server.Mappath("files/TEOGL.lua")
else
filespec = Server.Mappath("files/TEOAGL.lua")
end if
Set f = fso.OpenTextFile(filespec,1)

For intLine = 1 to 2
  f.SkipLine
Next

strLineCount = 1

Do While not f.AtEndOfStream
strReadLine = f.Readline
if InStr(LCase(Left(strReadLine,5)), "}") then
Do While not f.AtEndOfStream
  f.SkipLine
Loop
else
strReadline = replace(strReadline,"æ","æ")
strReadline = replace(strReadline,"ø","ø")
strReadline = replace(strReadline,"Ã¥","å")
strReadline = replace(strReadline,"ä","ä")
strReadline = replace(strReadline,"â","â")
strReadline = replace(strReadline,"ã","ã")
strReadline = replace(strReadline,"á","á")
strReadline = replace(strReadline,"Ã ","à")
strReadline = replace(strReadline,"ë","ë")
strReadline = replace(strReadline,"ê","ê")
strReadline = replace(strReadline,"é","é")
strReadline = replace(strReadline,"è","è")
strReadline = replace(strReadline,"ï","ï")
strReadline = replace(strReadline,"î","î")
strReadline = replace(strReadline,"Ã ","í")
strReadline = replace(strReadline,"ì","ì")
strReadline = replace(strReadline,"ö","ö")
strReadline = replace(strReadline,"ô","ô")
strReadline = replace(strReadline,"õ","õ")
strReadline = replace(strReadline,"ó","ó")
strReadline = replace(strReadline,"ò","ò")
strReadline = replace(strReadline,"ü","ü")
strReadline = replace(strReadline,"û","û")
strReadline = replace(strReadline,"ú","ú")
strReadline = replace(strReadline,"ù","ù")
strReadline = replace(strReadline,"ÿ","ÿ")
strReadline = replace(strReadline,"ý","ý")
strReadline = replace(strReadline,"´","'")
strReadline = replace(strReadline,"'","")
ArrReadline = split(strReadline,".rd.")
strReadline = ArrReadline(1)
ArrCharinfo = split(strReadline,".sp.")

strCharinfo_Char = ArrCharinfo(0)
strCharinfo_Level = ArrCharinfo(1)
strCharinfo_Class = ArrCharinfo(2)
strCharinfo_Rank = ArrCharinfo(3)
strCharinfo_GNote = ArrCharinfo(4)
strCharinfo_ONote = ArrCharinfo(5)

strRClass = replace(strCharinfo_Class,"Druid","1")
strRClass = replace(strRClass,"Hunter","2")
strRClass = replace(strRClass,"Mage","3")
strRClass = replace(strRClass,"Paladin","4")
strRClass = replace(strRClass,"Priest","5")
strRClass = replace(strRClass,"Rogue","6")
strRClass = replace(strRClass,"Shaman","7")
strRClass = replace(strRClass,"Warlock","8")
strRClass = replace(strRClass,"Warrior","9")

Select Case strCharinfo_Rank
    Case 0
        strCharinfo_Rank_i = 99
    Case 1
        strCharinfo_Rank_i = 91
    Case 2
        strCharinfo_Rank_i = 81
    Case 3
        strCharinfo_Rank_i = 73
    Case 4
        strCharinfo_Rank_i = 6
    Case 5
        strCharinfo_Rank_i = 5
    Case 6
        strCharinfo_Rank_i = 4
    Case 7
        strCharinfo_Rank_i = 3
    Case 8
        strCharinfo_Rank_i = 2
    Case 9
        strCharinfo_Rank_i = 1
End Select

strUpdateChar = "Nej"

set GuildList_rs = GuildList_conn.execute("select Id from `Character` where Charname = '"& strCharinfo_Char &"'")
if not GuildList_rs.eof then
strGuildList_SQL = "Update `Character` set "

strGuildList_SQL = strGuildList_SQL & "[Class] = " & strRClass & ", "
strGuildList_SQL = strGuildList_SQL & "[Level] = " & strCharinfo_Level & ", "
strGuildList_SQL = strGuildList_SQL & "Rang = " & strCharinfo_Rank_i & ", "
strGuildList_SQL = strGuildList_SQL & "Gnote = '" & strCharinfo_GNote & "', "
strGuildList_SQL = strGuildList_SQL & "CheckforDelete = 0, "
strGuildList_SQL = strGuildList_SQL & "Onote = '" & strCharinfo_ONote & "', "
strGuildList_SQL = strGuildList_SQL & "Acadamy = " & strFindOutAcadamy & " "
strGuildList_SQL = strGuildList_SQL & "Where Id = " & GuildList_rs("Id")

response.write strGuildList_SQL & "<br>"
GuildList_Conn.execute(strGuildList_SQL)
strUpdateChar = "Ja"
else
strGuildListAdd_SQL = "Insert into `Character` ("

strGuildListAdd_SQL = strGuildListAdd_SQL & "Charname, "
strGuildListAdd_SQL = strGuildListAdd_SQL & "[Class], "
strGuildListAdd_SQL = strGuildListAdd_SQL & "[Level], "
strGuildListAdd_SQL = strGuildListAdd_SQL & "[Rang], "
strGuildListAdd_SQL = strGuildListAdd_SQL & "Gnote, "
strGuildListAdd_SQL = strGuildListAdd_SQL & "CheckforDelete, "
strGuildListAdd_SQL = strGuildListAdd_SQL & "Onote, "
strGuildListAdd_SQL = strGuildListAdd_SQL & "Acadamy) "

strGuildListAdd_SQL = strGuildListAdd_SQL & "values( "

strGuildListAdd_SQL = strGuildListAdd_SQL & "`" & strCharinfo_Char & "`, "
strGuildListAdd_SQL = strGuildListAdd_SQL & strRClass & ", "
strGuildListAdd_SQL = strGuildListAdd_SQL & strCharinfo_Level & ", "
strGuildListAdd_SQL = strGuildListAdd_SQL & strCharinfo_Rank_i & ", "
strGuildListAdd_SQL = strGuildListAdd_SQL & "`" & strCharinfo_GNote & "`, "
strGuildListAdd_SQL = strGuildListAdd_SQL & "0, "
strGuildListAdd_SQL = strGuildListAdd_SQL & "`" & strCharinfo_ONote & "`, "
strGuildListAdd_SQL = strGuildListAdd_SQL & strFindOutAcadamy & ")"

response.write strGuildListAdd_SQL & "<br>"
GuildList_Conn.Execute(strGuildListAdd_SQL)
############################################################
####################  This is line 175  ####################
############################################################
strUpdateChar = "Added"

end if
GuildList_rs.close
set GuildList_rs = Nothing
%>  <tr>
    <td><%=strLineCount%></td>
    <td><%=strCharinfo_Char%></td>
    <td><%=strCharinfo_Level%></td>
    <td><%=strRClass%> - <%=strCharinfo_Class%></td>
    <td><%=strCharinfo_Rank%></td>
    <td><%=strCharinfo_GNote%></td>
    <td><%=strCharinfo_ONote%></td>
    <td><%=strUpdateChar%></td>
  </tr>
<%
strLineCount = strLineCount + 1
end if
Loop
f.Close
strGuildDel_SQL = "Delete from Character where CheckforDelete = 1 and Acadamy = " & strFindOutAcadamy & ""
response.write strGuildDel_SQL & "<br>"
GuildList_conn.Execute(strGuildDel_SQL)
%></table>
</body>
</html>

session("DSN"):
"DRIVER={MySQL ODBC 3.51 Driver}; SERVER=mydb4.surftown.dk; DATABASE=####_****; UID=####_****; PWD=*********"

Hvad er min fejl?
Avatar billede kalp Novice
25. januar 2007 - 21:27 #1
f.eks her
strGuildDelete_SQL = "Update `Character` set CheckforDelete = 1 where Acadamy = " & strFindOutAcadamy


er der skal ' rundt om din parameter.. altså

strGuildDelete_SQL = "Update `Character` set CheckforDelete = 1 where Acadamy = '" & strFindOutAcadamy & "'"
Avatar billede EIHP Juniormester
25. januar 2007 - 21:35 #2
for stadig den samme fejl
Avatar billede cpufan Juniormester
25. januar 2007 - 21:37 #3
strGuildDel_SQL = "Delete from Character where CheckforDelete = 1 and Acadamy = " & strFindOutAcadamy & ""
response.write strGuildDel_SQL & "<br>"
GuildList_conn.Execute(strGuildDel_SQL)

skal være

strGuildDel_SQL = "Delete from Character where CheckforDelete = 1 and Acadamy = '" & strFindOutAcadamy & "'"
response.write strGuildDel_SQL & "<br>"
GuildList_conn.Execute(strGuildDel_SQL)
Avatar billede EIHP Juniormester
25. januar 2007 - 22:13 #4
ny fejl:

Microsoft OLE DB Provider for ODBC Drivers error '80040e09'

[MySQL][ODBC 3.51 Driver][mysqld-4.1.21-log]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 'Character set Checkfo(

/test/read.asp, line 34
Avatar billede EIHP Juniormester
25. januar 2007 - 22:23 #5
JEg har løst det.. jeg ændret bare fieldnavne fra Class, Level, Rank til FClass, Flevel, FRank.. og så forsvandt fejlene :D
Avatar billede EIHP Juniormester
10. april 2007 - 10:08 #6
men tak for hjælpen kalp og cpufan, ligger I ikke begge et svar?

Jeg tag selv points hvis der ikke bliver lagt et svar indenfor 5 dage
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