Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ASP Coding and DBF Database
Message
From
23/02/2003 22:15:51
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
ASP Coding and DBF Database
Miscellaneous
Thread ID:
00756840
Message ID:
00756840
Views:
36
i have this problem and i need to ask you guys if you can help in this problem.......i cant seem to find where i am wrong in my code hope you guys can help me ASAP.....id been trying to figure the problem for the last 8 days...

here is the code in my asp

**********************List2.asp**********************************************
<%@ LANGUAGE=VBScript %>

<html>

<body>

<%
Set conn = Server.CreateObject("ADODB.Connection")
conn.mode = 16
conn.ConnectionString= "Provider=VFPOLEDB.1;Data Source=c:\database\mydatabase.dbc"
conn.open

set rs=Server.CreateObject("ADODB.Recordset")
rs.open "SELECT * FROM test",conn
%><h2>List Database</h2>
<table border="1" width="100%">
<tr>
<%
for each x in rs.Fields
  response.write("<th>" & ucase(x.name) & "</th>")
next
%>
</tr>
<% do until rs.EOF %>
<tr>
<form method="post" action="demo_delete.asp">
<%
for each x in rs.Fields
  if x.name="idnum" then%>
    <td>
    <input type="submit" name="idnum" value="<%=x.value%>">
    </td>
  <%else%>
    <td><%Response.Write(x.value)%> </td>
  <%end if
next
%>
</form>
<%rs.MoveNext%>
</tr>
<%
loop
conn.close
%>
</table>

</body>

</html>
*************************demo_delete.asp******************
<%@ LANGUAGE=VBScript %>

<html>

<body>

<h2>Delete Record</h2>
<%
Set conn = Server.CreateObject("ADODB.Connection")
    conn.mode = readwrite
    conn.ConnectionString= "Provider=VFPOLEDB.1;Data Source=c:\database\mydatabase.dbc"
    conn.open
    set rs = Server.CreateObject("ADODB.recordset")
	rs.Open "Select * from test", conn

dim id, id2
id = Request.Form("idnum")
id2 = Trim(id)

if Request.form("frstname")="" then
  set rs=Server.CreateObject("ADODB.Recordset")
  rs.open "SELECT * FROM test where idnum= & id2" ,conn
  %>
  <form method="post" action="demo_update.asp">
  <table>
  <%for each x in rs.Fields%>
  <tr>
  <td><%=x.name%></td>
  <td><input name="<%=x.name%>" value="<%=x.value%>" size="20"></td>
  <%
  next
  %>
  </tr>
  </table>
  <br /><br />
  <input type="submit" value="Delete record">
  </form>
<%
else
  sql="DELETE FROM test"
  sql=sql & " WHERE idnum= & id2" 
  on error resume next
  conn.Execute sql
  if err<>0 then
    response.write("No update permissions!")
  else 
    response.write("Record " & id2 & " was deleted!")
  end if 
end if
conn.close
%>

</body>

</html>
************************************************************************
now here is my table structure in DBF....c:\database\test.dbf

Field Field Name Type Width
1 IDNUM Character 3 -------Id Number
2 FRSTNAME Character 20 -------First name
3 MIDNAME Character 20 -------Middle NAme
4 LASNAME Character 20 -------Last name
5 ADDRESS Character 100 -------Address
6 CONTNUM Character 15 -------Contact Number

----------------------------------------------------------------------
Next
Reply
Map
View

Click here to load this message in the networking platform