gsc1ugs
Oct 20th, 2000, 05:33 AM
Can anyone tell me what to add to this to add the form entries, this function display the form and adds the field names the each input type to save time for testing, i would then like to add contents to DB
******* CODE******
Private Function AddEntry()
Dim strQuery ' SQL String
Dim RS ' Recordset object
Dim cn 'adodb.connection
Dim strConn
Dim StrSort
'This section sorts .
if request.form("sort")<> "" THEN
StrSort=request.form("sort")
ELSE
StrSort="ID"
END IF
' Create our connection string
strConn = GetConnectionString()
strQuery="SELECT * FROM SUGGESTION ORDER BY " &StrSort
set RS = CreateObject("ADODB.Recordset")
RS.CursorLocation = 3 ' adUseClient
RS.Open strQuery, strConn ' adOpenKeyset CursorType
%>
<h3>Suggestions Box</h3>
<form name="SUGGESTION" action="/mlintranetsite/suggestion.asp?pageid=view" method="POST">
<table border=1 bordercolor="#e70f7f" cellspacing=1 cellpadding=1 rules=box>
<%
ON ERROR RESUME NEXT
IF RS.eof THEN
Response.Write "There are no entries in the database."
ELSE
%>
<tr>
<%
FOR i = 1 to RS.Fields.Count -1
Response.Write "<td><p><b>" & RS(i).Name & "<b></p></td>"
NEXT
WHILE NOT RS.EOF
%>
</tr>
<tr>
<%
FOR i = 1 to RS.Fields.Count -1
Response.Write "<td><input type=text name=" & RS(i).Name & " value=" & RS(i).Name & "></B></td>"
NEXT
RS.MoveNext
%>
</tr>
<%
WEND
RS.Close
END IF
%>
</table>
</form>
<form name="SUGGESTION" action="/mlintranetsite/suggestion.asp?pageid=addrecord" method=post>
<input name=add value="Add" type=submit>
<INPUT TYPE="hidden" NAME="tablename" VALUE="<%=REFRESH_TABLE%>">
</form>
<form name="SUGGESTION" action="suggestion.asp?pageid=search" method=post>
<INPUT TYPE="hidden" NAME="tablename" VALUE="<%=MODE_RESULTS%>">
<input name=keyword value="Search" type=submit>
</form>
<%
End Function
******* CODE******
Private Function AddEntry()
Dim strQuery ' SQL String
Dim RS ' Recordset object
Dim cn 'adodb.connection
Dim strConn
Dim StrSort
'This section sorts .
if request.form("sort")<> "" THEN
StrSort=request.form("sort")
ELSE
StrSort="ID"
END IF
' Create our connection string
strConn = GetConnectionString()
strQuery="SELECT * FROM SUGGESTION ORDER BY " &StrSort
set RS = CreateObject("ADODB.Recordset")
RS.CursorLocation = 3 ' adUseClient
RS.Open strQuery, strConn ' adOpenKeyset CursorType
%>
<h3>Suggestions Box</h3>
<form name="SUGGESTION" action="/mlintranetsite/suggestion.asp?pageid=view" method="POST">
<table border=1 bordercolor="#e70f7f" cellspacing=1 cellpadding=1 rules=box>
<%
ON ERROR RESUME NEXT
IF RS.eof THEN
Response.Write "There are no entries in the database."
ELSE
%>
<tr>
<%
FOR i = 1 to RS.Fields.Count -1
Response.Write "<td><p><b>" & RS(i).Name & "<b></p></td>"
NEXT
WHILE NOT RS.EOF
%>
</tr>
<tr>
<%
FOR i = 1 to RS.Fields.Count -1
Response.Write "<td><input type=text name=" & RS(i).Name & " value=" & RS(i).Name & "></B></td>"
NEXT
RS.MoveNext
%>
</tr>
<%
WEND
RS.Close
END IF
%>
</table>
</form>
<form name="SUGGESTION" action="/mlintranetsite/suggestion.asp?pageid=addrecord" method=post>
<input name=add value="Add" type=submit>
<INPUT TYPE="hidden" NAME="tablename" VALUE="<%=REFRESH_TABLE%>">
</form>
<form name="SUGGESTION" action="suggestion.asp?pageid=search" method=post>
<INPUT TYPE="hidden" NAME="tablename" VALUE="<%=MODE_RESULTS%>">
<input name=keyword value="Search" type=submit>
</form>
<%
End Function