Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Please Help Me Populate a Form/table with DB

Status
Not open for further replies.

campbere

Technical User
Oct 10, 2000
146
US
I have been working on trying to populate my form/table. Not sure if you actually call it a form since it incoporates tables. I have the following code that displays the layout of the form. (This is only one row of the form there is much more to it.)

<html>
<head>
<title>Home Page</title>
</head>
<body>
<form method=&quot;POST&quot;>
<fieldset>
<br>
<table border=0 cellspacing=0 cellpadding=4 width=640>
<tr><p>
<td width=&quot;80&quot; height=&quot;23&quot;><font face=&quot;Times New Roman&quot; size=&quot;3&quot;>
<strong>PROD NUM</strong>
</td>
<td height=&quot;23&quot;><font face=&quot;Times New Roman&quot; size=&quot;3&quot; align=&quot;Left&quot;>
<input name=&quot;prodnum&quot; type=&quot;TEXT&quot; size=&quot;10&quot; maxlength=&quot;8&quot; text=&quot;2&quot;>
</td>
<td width=&quot;90&quot; height=&quot;23&quot;><font face=&quot;Times New Roman&quot; size=&quot;3&quot;>
<strong>PROD TYPE</strong>
</td>
<td height=&quot;23&quot;><font face=&quot;Times New Roman&quot; size=&quot;3&quot;
align=&quot;Left&quot;>
<input name=&quot;prodtype&quot; type=&quot;TEXT&quot; size=&quot;10&quot;
maxlength=&quot;12&quot;>
</td>
<td width=&quot;85&quot; height=&quot;23&quot;><font face=&quot;Times New Roman&quot;
size=&quot;3&quot;><strong>PROD DATE</strong>
</td>
<td height=&quot;23&quot;><font face=&quot;Times New Roman&quot; size=&quot;3&quot;
align=&quot;Left&quot;>
<input name=&quot;proddate&quot; type=&quot;TEXT&quot; size=&quot;10&quot;
maxlength=&quot;12&quot;>
</td>
<td width=&quot;150&quot; height=&quot;23&quot;><font face=&quot;Times New
Roman&quot; size=&quot;3&quot;><strong>Prod Count</strong>
</td>
<td height=&quot;23&quot;><font face=&quot;Times New Roman&quot; size=&quot;3&quot;
align=&quot;Left&quot;>
<input name=&quot;prodcount&quot; type=&quot;TEXT&quot; size=&quot;5&quot;
maxlength=&quot;3&quot;>
</td>
</tr></p>
</table>
<p></p>
</fieldset>
</body>

</html>

So that code creates my lovely looking form. I just dont understand how to incorporate code that populates it with values from the database.

I have written the following for the Oracle 8.1.7 connection:

<%
'Varibles to establish Oracle Connection
Dim objConn
Dim strConnection
Dim RS

Set objConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
strConnection=&quot;Provider=OraOLEDB.Oracle;Data Source=DVDB;User ID=sup_man;Password=kryptonite;&quot;
objConn.Open strConnection

Set Rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)
RS.Open &quot;Select * from product where prod_num = '00000000'&quot;, objConn

do while not rs.EOF
Response.Write rs(&quot;prod_num&quot;) & &quot;<br>&quot;
Response.Write rs(&quot;prod_type&quot;) & &quot;<br>&quot;
Response.Write rs(&quot;prod_date&quot;) & &quot;<br>&quot;
Response.Write rs(&quot;prod_count&quot;) & &quot;<br>&quot;

rs.MoveNext ' Movenext
loop

'Deinitialize the Connection and Recordset
set Rs = nothing
set objconn = nothing
%>

Currently all this does is print out the prod_num to the screen. Like I said I am trying to move to the next level to populate each of the text boxes of the form that has already been established.

I really apreciate your help and apologize for any formatting problems when viewing this.

Thanks,

campbere
 
Try setting the value for the text area as shown below!

<input type=&quot;text&quot; name=&quot;Subject&quot;
size=&quot;20&quot; value=&quot;<%= rs(&quot;Subject&quot;)%>&quot;>


Good luck!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top