546
צפיות
צפיות
5
תשובות
תשובות
בעיה בהוספת נתונים למסד נתונים והצג
*והצגתם.
http://serv-to.ath.cx/~/snir/DB/book2/go.htm
זו הכתובת של שליחת הנתונים שבניתי, עכשיו, זה פשוט לא מציג לי את הנתונים….
אני כמעט בטוח שהטעות היא ב- form כי….. נו טוב מיהרתי ל JS בזמנו ודילגתי על 2-3 פרקים בספר ה- html…….
אז מה הבעיה פה למעשה?
5 תשובות
אנחנו לא יכולים לנחש
בלי לראות קוד. צרף את קוד דף ה ASP.
הנה הקוד:
<%
set con = server.createobject("adodb.connection")
con.open "driver={microsoft access driver (*.mdb)}; dbq=" & server.mappath("phone_book.mdb") & ";"
set rs = con.execute("select * from personal_details")
if request("page") = "add" then
con.execute "insert into personal_details (fname,lname,tel) values ('" & request("fname") & "','" & request("lname") & "','" & request("tel") & "')"
end if
%>
<table border="5" width="200" cellpadding="1" cellspacing="1" style="font-size:12px;">
<tr>
<td bgcolor=yellow text=res width="70" class="bgcolor2"><b><center>שם פרטי </b></td>
<td bgcolor=yellow text=res width="80" class="bgcolor2"><b><center>שם משפחה </b></td>
<td bgcolor=yellow text=res width="100" class="bgcolor2"><b><center>מספר טלפון </b></td>
</tr>
<%
while not rs.eof
%>
<tr>
<td bgcolor=red text=yellow width="75" class="bgcolor1"><b><center><%=rs("fname")%></b></td>
<td bgcolor=red text=yellow width="85" class="bgcolor1"><b><center><%=rs("lname")%></b></td>
<td bgcolor=red text=yellow width="105" class="bgcolor1"><b><center><%=rs("tel")%></b></td>
</tr>
<%
rs.movenext
wend
%></table>
תיישר לשמאל.
ככה
הנה הקוד מיושר לשמאל:
הנה הקוד שוב:
<%
set con = server.createobject("adodb.connection")
con.open "driver={microsoft access driver (*.mdb)}; dbq=" & server.mappath("phone_book.mdb") & ";"
set rs = con.execute("select * from personal_details")
if request("page") = "add" then
con.execute "insert into personal_details (fname,lname,tel) values ('" & request("fname") & "','" & request("lname") & "','" & request("tel") & "')"
end if
%>
<table border="5" width="200" cellpadding="1" cellspacing="1" style="font-size:12px;">
<tr>
<td bgcolor=yellow text=res width="70" class="bgcolor2"><b><center>שם פרטי </b></td>
<td bgcolor=yellow text=res width="80" class="bgcolor2"><b><center>שם משפחה </b></td>
<td bgcolor=yellow text=res width="100" class="bgcolor2"><b><center>מספר טלפון </b></td>
</tr>
<%
while not rs.eof
%>
<tr>
<td bgcolor=red text=yellow width="75" class="bgcolor1"><b><center><%=rs("fname")%></b></td>
<td bgcolor=red text=yellow width="85" class="bgcolor1"><b><center><%=rs("lname")%></b></td>
<td bgcolor=red text=yellow width="105" class="bgcolor1"><b><center><%=rs("tel")%></b></td>
</tr>
<%
rs.movenext
wend
%></table>
מה הבעיה פה?
תעשה ככה:
<%
set con = server.createobject("adodb.connection")
con.open "driver={microsoft access driver (*.mdb)}; dbq=" & server.mappath("phone_book.mdb") & ";"
set rs = con.execute("select * from personal_details")
if (request.querystring("fname") <> "" AND request.querystring("lname") <> "" AND request.querystring("tel") <> "") then
con.execute "insert into personal_details (fname,lname,tel) values ('" & request("fname") & "','" & request("lname") & "','" & request("tel") & "')"
end if
%>
<table border="5" width="200" cellpadding="1" cellspacing="1" style="font-size:12px;">
<tr>
<td bgcolor=yellow text=res width="70" class="bgcolor2"><b><center>שם פרטי </b></td>
<td bgcolor=yellow text=res width="80" class="bgcolor2"><b><center>שם משפחה </b></td>
<td bgcolor=yellow text=res width="100" class="bgcolor2"><b><center>מספר טלפון </b></td>
</tr>
<%
while not rs.eof
%>
<tr>
<td bgcolor=red text=yellow width="75" class="bgcolor1"><b><center><%=rs("fname")%></b></td>
<td bgcolor=red text=yellow width="85" class="bgcolor1"><b><center><%=rs("lname")%></b></td>
<td bgcolor=red text=yellow width="105" class="bgcolor1"><b><center><%=rs("tel")%></b></td>
</tr>
<%
rs.movenext
wend
%></table>