|
|
|
ช่วยด่วนหน่อยนะคะ Microsoft OLE DB Provider for ODBC Drivers error '80040e07' |
|
|
|
|
|
|
|
Code (ASP)
<html>
<head>
<title>ThaiCreate.Com Ajax Tutorial</title>
</head>
<script language="JavaScript">
var HttPRequest = false;
function doCallAjax(Mode,ID) {
HttPRequest = false;
if (window.XMLHttpRequest) { // Mozilla, Safari,...
HttPRequest = new XMLHttpRequest();
if (HttPRequest.overrideMimeType) {
HttPRequest.overrideMimeType('text/html');
}
} else if (window.ActiveXObject) { // IE
try {
HttPRequest = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
HttPRequest = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {}
}
}
if (!HttPRequest) {
alert('Cannot create XMLHTTP instance');
return false;
}
var url = 'AjaxASPDeleteRecord2.asp';
var pmeters = "tMode=" + Mode +
"&tID=" + ID;
HttPRequest.open('POST',url,true);
HttPRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
HttPRequest.setRequestHeader("Content-length", pmeters.length);
HttPRequest.send(pmeters);
HttPRequest.onreadystatechange = function()
{
if(HttPRequest.readyState == 3) // Loading Request
{
document.getElementById("mySpan").innerHTML = "Now is Loading...";
}
if(HttPRequest.readyState == 4) // Return Request
{
document.getElementById("mySpan").innerHTML = HttPRequest.responseText;
}
}
}
</script>
<body Onload="JavaScript:doCallAjax('LIST','');">
<h1>My Customer</h1>
<form name="frmMain">
<span id="mySpan"></span>
</form>
</body>
</html>
Dim strMode,strID
strMode = Request.Form("tMode")
strID = Request.Form("tID")
Dim Conn,strSQL,objExec,objRec
Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("db/mydatabase.mdb"),"" , ""
If strMode = "DELETE" Then
strSQL = ""
strSQL = strSQL&"DELETE FROM customer "
strSQL = strSQL&"WHERE CustomerID = '"&strID&"' "
Set objExec = Conn.Execute(strSQL)
End IF
strSQL = "SELECT * FROM customer ORDER BY CustomerID ASC "
Set objRec = Server.CreateObject("ADODB.Recordset")
objRec.Open strSQL, Conn, 1,3
%>
<table width="600" border="1">
<tr>
<th width="91"> <div align="center">CustomerID</div></th>
<th width="98"> <div align="center">Name</div></th>
<th width="198"> <div align="center">Email</div></th>
<th width="97"> <div align="center">CountryCode</div></th>
<th width="59"> <div align="center">Budget</div></th>
<th width="71"> <div align="center">Used</div></th>
<th width="40"> <div align="center">Delete</div></th>
</tr>
<%
While Not objRec.EOF
%>
<tr>
<td><div align="center"><%=objRec.Fields("CustomerID").Value%></div></td>
<td><%=objRec.Fields("Name").Value%></td>
<td><%=objRec.Fields("Email").Value%></td>
<td><div align="center"><%=objRec.Fields("CountryCode").Value%></div></td>
<td align="right"><%=objRec.Fields("Budget").Value%></td>
<td align="right"><%=objRec.Fields("Used").Value%></td>
<td align="center"><a href="JavaScript:doCallAjax('DELETE',' <%=objRec.Fields("CustomerID").Value%>');">Del</a></td>
</tr>
<%
objRec.MoveNext
Wend
%>
</table>
<%
objRec.Close()
Conn.Close()
Set objRec = Nothing
Set Conn = Nothing
%>
Code
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
/codetest/code/de2.asp, line 20
อยากทราบว่าจะแก้ยังไงดีคะทำยังไงก้แก้ไม่ได้ค่ะ
Tag : ASP, Ms Access, Ajax
|
|
|
|
|
|
Date :
2012-03-11 17:57:49 |
By :
typex |
View :
1662 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ถ้ามันเป็น Number ให้ใช้
Code (ASP)
strSQL = strSQL&"WHERE CustomerID = "&strID&" "
คือถ้า asp ฟิวด์ประเภท number ห้ามใช้ ' ' ส่วน string ใช้ได้
|
|
|
|
|
Date :
2012-03-11 18:57:27 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|