รายละเอียดของการตอบ ::
ขอบคุณมากครับ ผมลองทำแบบวิธีพี่แล้วครับแต่มันติดอยู่ครับรบกวนดูให้ผมหน่อยครับ
หน้าเพิ่มข้อมูล
<html>
<head>
<title>ThaiCreate.Com ASP & Microsoft Access Tutorial</title>
</head>
<body>
<form action="aspmema3.asp" name="frmAdd" method="post">
<table width="600" border="1">
<tr>
<th width="91"> <div align="center">date_t </div></th>
<th width="160"> <div align="center">lam_num</div></th>
<th width="198"> <div align="center">nam_emp</div></th>
<th width="97"> <div align="center">nam_cos </div></th>
<th width="70"> <div align="center">id_cos</div></th>
<th width="70"> <div align="center">rup_tum </div></th>
<th width="70"> <div align="center">sun_tum</div></th>
<th width="70"> <div align="center">pen_tum</div></th>
<th width="70"> <div align="center">pen_totol </div></th>
<th width="70"> <div align="center">sum</div></th>
<th width="70"> <div align="center">exepen </div></th>
</tr>
<tr>
<td><div align="center"><input type="text" name="txtdate_t " size="10"></div></td>
<td><div align="center"><input type="text" name="txtlam_num" size="10"></div></td>
<td><div align="center"><input type="text" name="txtnam_emp" size="20"></div></td>
<td><div align="center"><input type="text" name="txtnam_cos" size="20"></div></td>
<td><div align="center"><input type="text" name="txtid_cos" size="13"></div></td>
<td><div align="center"><input type="text" name="txtrup_tum" size="10"></div></td>
<td><div align="center"><input type="text" name="txtsun_tum" size="10"></div></td>
<td><div align="center"><input type="text" name="txtpen_tum" size="10"></div></td>
<td><div align="center"><input type="text" name="txtpen_totol" size="10"></div></td>
<td><div align="center"><input type="text" name="txtsum" size="10"></div></td>
<td><div align="center"><input type="text" name="txtexepen" size="10"></div></td>
</tr>
</table>
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>
หน้าส่งข้อมูล
<% Option Explicit %>
<html>
<head>
<title>ThaiCreate.Com ASP & Microsoft Access Tutorial</title>
</head>
<body>
<%
Dim Conn,strSQL,objExec
Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("db2.mdb"),"" , ""
strSQL = ""
strSQL = strSQL &"INSERT INTO acon "
strSQL = strSQL &"(date_t, lam_num, nam_emp, nam_cos, id_cos, rup_tum, sun_tum, pen_tum, pen_totol, sum,exepen) "
strSQL = strSQL &"VALUES "
strSQL = strSQL &"('"&Request.Form("txtdate_t")&"','"&Request.Form("txtlam_num")&"', '"&Request.Form("txtnam_emp")&"' "
strSQL = strSQL &",'"&Request.Form("txtnam_cos")&"','"&Request.Form("txtid_cos")&"', '"&Request.Form("txtrup_tum")&"' "
strSQL = strSQL &",'"&Request.Form("txtsun_tum")&"','"&Request.Form("txtpen_tum")&"', '"&Request.Form("txtpen_totol")&"' "
strSQL = strSQL &",'"&Request.Form("txtsam")&"','"&Request.Form("txtexepen")&"') "
Set objExec = Conn.Execute(strSQL) ติดตรงนี้ครับ
If Err.Number = 0 Then
Response.write("Save Done.")
Else
Response.write("Error Save ["&strSQL&"] ("&Err.Description&")")
End If
Conn.Close()
Set objExec = Nothing
Set Conn = Nothing
%>
</body>
</html>