set s=Dt.execute(zz)
Response.write("Error = " & Err.Desctiption)
เอา Error มาดูหน่อยครับ
Date :
2013-08-24 18:17:37
By :
mr.win
No. 2
Guest
Code (ASP)
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
/DB.asp, line 32
<center>
<a href="?m=1"><font color="#ff00ff" size="15">input</font></a>
<a href="?m=2"><font color="#ff0000" size="15">show</font></a>
<%
Set Jn = Server.CreateObject("ADODB.Connection")
Jn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db.mdb")
if request("m")=1 then
input
end if
if request("m")=2 then
show
end if
'----input----''
sub input()
%>
<hr>
<form method="get" onsubmit="javascript:alert('¤Ø³ä´é·Ó¡Òúѹ·Ö¡¢éÍÁÙÅàÃÕºÃéÍÂáÅéÇ');">
ÃËÑÊ::<input type="text" name="num" maxlength="11"><br>
ª×èÍ::<input type="text" name="name_std"><br>
email::<input type="text" name="email"><br>
à¡Ã´::<input type="text" name="grade"><br>
<input type="hidden" name="m" value="1">
<input type="submit" name="OK" action="show">
<%
if request("num")<>"" then
db_er=0
end if
%>
</form>
<%
if len(request("num"))<>11 then
db_er=1
end if
if request("name_std")=(IsNumeric("name_std")) then
db_er=2
end if
email=request("email")
if request("email")<>(InStrRev(email,"@")) then
db_er=3
if request("email")<>(InStrRev(email,".com")) then
db_er=4
end if
end if
if request("num")<>"" and db_er=0 then
x="insert into std (ID,name_std,email,grade) values ('"&request("num")&"','"&request("name_std")&"','"&request("email")&"','"&request("grade")&"') "
set ins=Jn.execute(x)
end if
end sub
'----show----''
sub show
if request("del")<>""then
d="delete from std where id='"&request("del")&"' "
set de=Jn.execute(z)
end if
'------------del all-----------
if request(m)=3 then
d="delete from std"
set adel=Jn.execute(d)
end if
z="select * from std"
set s=Jn.execute(z) 'à¡çº z äÇéã¹ s
%>
<hr>
<%
do while not s.eof ''eof äÁè
%>
<table>
<tr>
<td width="20" align="right"><%=s("ID")%></td>
<td width="150" align="right"><%=s("name_std")%></td>
<td width="70"><%=s("grade")%></td>
<td width="50" align="center"><a href='?m=2&del=?=s("num")' onclick="µéͧ¡ÒÃź¢éÍÁÙÅËÃ×ÍäÁè">Delete</a></td>
<td width="50" align="center"><a href='?m=4("num")' onclick="µéͧ¡ÒÃá¡é䢢éÍÁÙÅËÃ×ÍäÁè">Edit</a></td>
<%
s.movenext
loop
%>
</tr>
</table>
<a href="?m=5">Delete All</a>
<%
s.close '¶éÒ select ¨Ðµéͧ»Ô´àÊÁÍ
end sub
'------------edit------------
sub edit
if request("m")=4then
%>
·èÒ¹µéͧ¡ÒÃá¡éä¢ <%=request("ed")%>
<%
z="select * from std"
set sel=Jn.execute(z)
e="update set'"&request("ed")&"' on std"
set e=Jn.execute(e)
%>
<form method="post" onsubmit="¤Ø³ä´é·Ó¡ÒÃá¡éä¢àÊÃç¨àÃÕºÃéÍÂáÅéÇ">
ÃËÑÊ::<input type="text" name="id" value="'<%=request("ID")%>'" size="11" readonly="true"/> <br>
ª×èÍ:: <input type="text" name="id" value="'<%=request("name_std")%>'" size="100" readonly="true"/><br>
email:: <input type="text" name="id" value="'<%=request("email")%>'" size="10" readonly="true"/><br>
à¡Ã´:: <input type="text" name="id" value="'<%=request("grade")%>'" size="10" readonly="true"/><br>
</form>
<%
end if
end sub
sub del_all
end sub
Jn.close
%>
</center>