 |
|
ผมใช้ lls ในวิน xp ติดต่อฐานข้อมูล Access 2002 ไม่ได้แนะนำหน้อยครับ |
|
 |
|
|
 |
 |
|
คือว่าผม จะหัดเขียน asp นะครับ ในวิน xp ผมสามารถดูข้อมูลในตารางของAccess 2002 แต่ผมเพิ่มข้อมูลเข้าไปในตารางไม่ได้ครับ ผมมีสคริปมาให้ดูครับ
ผมใช้สคริปนี้ดูฐานข้อมูลในตารางได้ครับ
<%
Set Conn=Server.Createobject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("db/product.mdb"),"" , ""
'หรือจะใช้เป็น Conn.Open "product","",""
sql ="Select * From product"
Set Rs = Conn.Execute(sql)
If Rs.EOF Then
%>
ไม่มีข้อมูลในตาราง !
<%Else%>
<table border="1">
<tr bgcolor="Silver">
<td>id</td>
<td>barcode</td>
<td>Description</td>
<td>Price</td>
<td>Page</td>
<td>writer</td>
</tr>
<% While Not Rs.EOF%>
<tr>
<td><%= Rs("Id")%></td>
<td><%= Rs("barcode")%></td>
<td><%= Rs("description")%></td>
<td><%= Rs("price")%></td>
<td><%= Rs("page")%></td>
<td><%= Rs("writer")%></td>
</tr>
<% Rs.MoveNext
Wend
Rs.Close
Conn.Close
End If
%>
</table>

แต่ว่าปัญหาผมเริ่มตั้งแต่ช้วงนีครับ สคริปนี้เป็นฟอร์มเพิ่มข้อมูลลงในตารางผมครับสามารถเปิดได้เช่นกันครับ
<html>
<head>
<title>กรุณากรอกข้อมูลให้ครบทุกช่องครับ</title>
<body bgcolor="#FFFFFF">
<form name="form1" method="post" action="Sample3.asp">
กรุณากรอกข้อมูล<br>
<br>
<table width="28%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="41%">Barcode</td>
<td width="59%">
<input type="text" name="barcode">
</td>
</tr>
<tr>
<td width="41%">Description</td>
<td width="59%">
<input type="text" name="description">
</td>
</tr>
<tr>
<td width="41%">Price</td>
<td width="59%">
<input type="text" name="price" size="10">
</td>
</tr>
<tr>
<td width="41%">Page</td>
<td width="59%">
<input type="text" name="page" size="10">
</td>
</tr>
<tr>
<td width="41%">Writer</td>
<td width="59%">
<input type="text" name="writer">
</td>
</tr>
</table>
<br>
<input type="submit" name="Submit2" value="Submit">
<input type="reset" name="Reset" value="Reset">
</form>
</body>
</html>

สวนอันนี้เป็นสคริปสำหรับส่ง ครับ มีปัญหาส่งไม่ได้ช้วยดูสคริปให้ผมทีนะครับว่าต้องแก้ใขตรงไหนและทำยังไงดี
<%
Set Conn=Server.Createobject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("db/product.mdb"),"" , ""
sql ="Select * From product where barcode='"&Request.Form("barcode")&"'" ' ป้องกัน barcode ซ้ำ
Set RS =Server.CreateObject("ADODB.Recordset")
RS.open Sql,Conn,1,3
if NOT(RS.EOF) then
response.write("รหัส barcode นี้มีอยู่แล้ว")
else
Rs.AddNew
Rs("barcode") = Request.Form("barcode")
Rs("description") = Request.Form("description")
Rs("price") = Request.Form("price")
Rs("page") = Request.Form("page")
Rs("writer") = Request.Form("writer")
Rs.Update
Conn.Close
response.write("เพิ่มข้อมูลเรียบร้อยแล้ว")
end if
%>
พอผมกดส่งแล้วมันขึ้นข้อความเตื่อนอย่างนี้นะครับ
The page cannot be displayed
There is a problem with the page you are trying to reach and it cannot be displayed.
--------------------------------------------------------------------------------
Please try the following:
Click the Refresh button, or try again later.
Open the localhost home page, and then look for links to the information you want.
HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services
--------------------------------------------------------------------------------
Technical Information (for support personnel)
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Cannot update. Database or object is read-only.
/Sample3.asp, line 16
Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Page:
POST 83 bytes to /Sample3.asp
POST Data:
barcode=0014&description=dasda&price=50&page=500&writer=%E4%C1%C1%E8&Submit2=Submit
Time:
16 ตุลาคม 2547, 11:07:04
More information:
Microsoft Support
แนะนำหน่อยนะครับคือว่าแก้ไม่ตกเลยครับ
Tag : - - - -
|
|
 |
 |
 |
 |
Date :
16 ต.ค. 2547 11:19:19 |
By :
jimnaruk |
View :
2909 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ระบบ OS ของคุณเป็นแบบ NTFS
อาจจะลองเปลี่ยนให้เป็นระบบ FAT32
หรือไม่ก็ง่ายสุด ก็คือทำการ Map Vertual Directory ครับ
|
 |
 |
 |
 |
Date :
16 ต.ค. 2547 16:18:36 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เนื่องจากแฟ้มของคุณเป็นชนิดอ่านได้อย่างเดียวครับ ต้องทำการแก้ไข โดยการ คลิกขวา ที่ โฟล์เดอร์ แล้วคลิกเลือก websharing =>แชร์ไฟล์ =>แล้วเลือกให้มันสามารถเขียนได้แก้ไขได้ตามใจชอบครับ
|
 |
 |
 |
 |
Date :
17 ต.ค. 2547 13:56:47 |
By :
sandee |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อ้าวเหรอ แสดงว่าผมคิดไปไกลเลยทีเดียว 
ก็คนไม่ค่อยถนัด ASP ด้วยครับ ยังไงถ้าได้ผลก็แนะนำกันด้วยครับ

|
 |
 |
 |
 |
Date :
18 ต.ค. 2547 10:12:43 |
By :
@W_IN |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|