-
Fill a textbox with fielddata relating to selected dropdown
I'm new to web development but have 7 years VB experience.. and this is my
first little test...
I want to be able to choose an item from my dropdown box (yes I figured out
how to fill it!) and then according to the choice fill in the values of 3
related fields from the same recordset into 3 textboxes... I also want to
be able to delete the chosen record from the database or the option to enter
my own data into the 3 textboxes and have it add the record to the database.
Can someone point me in the right direction of what I need to add to or amend
from this code:
My database is SQL Server 2000... one database with one table with 4 fields...
seems simple enough, this would take me about 10 seconds to do in VB... thanks
<%@ Language=VBScript %>
<% ' VI 6.0 Scripting Object Model Enabled %>
<!--#include file="_ScriptLibrary/pm.asp"-->
<% if StartPageProcessing() Then Response.End() %>
<form name="thisForm" METHOD="post">
<form name="thisForm" METHOD="post">
<html>
<head>
<meta NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<link REL="stylesheet" TYPE="text/css" HREF="_Themes/zero/THEME.CSS" VI6.0THEME="Zero">
<link REL="stylesheet" TYPE="text/css" HREF="_Themes/zero/GRAPH0.CSS" VI6.0THEME="Zero">
<link REL="stylesheet" TYPE="text/css" HREF="_Themes/zero/COLOR0.CSS" VI6.0THEME="Zero">
<link REL="stylesheet" TYPE="text/css" HREF="_Themes/zero/CUSTOM.CSS" VI6.0THEME="Zero"></head>
<body>
<p><font face="Tahoma" size="7"><strong>Password Database</strong> </font></p>
<form name="input" action="processed.asp" method="post">
<%
Dim myConn
Set MyConn = Server.CreateObject("ADODB.Connection")
myConn.Open "driver={SQL Server};SERVER=CI942695-A\Local;Database=Password;UID=David;pwd=belfast"
If myConn.State = 1 Then
Set myRS = myConn.Execute("Select * From tblMain Order By txtApp Asc")
%>
<pre><select id="cboChoose" style="LEFT: 420px; WIDTH: 198px; TOP: 45px"
name="cboChoose">
<%
Do Until myRS.EOF
%>
<option value="<%=myRS("autID")%>"><%=myRS("txtAPP")%> </option>
<%
myRS.movenext
Loop
%>
</select> <font face="Tahoma">Choose a Program/Website/Other...</font></pre>
<%
Else
Response.Write("Error. Connection could not be opened.<P>")
End If
myConn.Close
Set myConn = Nothing
%>
<pre><input id="txtProgram" style="WIDTH: 198px; HEIGHT: 22px" size="24"
name="txtProgram"> <font face="Tahoma">Program/Website/Other...</font></pre>
<pre><input id="txtUser" style="WIDTH: 198px; HEIGHT: 22px" size="24" name="txtUser">
<font face="Tahoma">User Name/Logon/Other...</font></pre>
<pre><input id="txtPassword" style="WIDTH: 198px; HEIGHT: 22px" size="24"
name="txtPassword"> <font face="Tahoma">Password/Other...</font></pre>
<pre><input id="cmdSubmit" type="submit" value="Submit" name="cmdSubmit"></pre>
<pre><input id="cmdReset" type="reset" value="Reset" name="cmdReset"></pre>
</form>
</body>
<% ' VI 6.0 Scripting Object Model Enabled %>
<% EndPageProcessing() %>
</form>
</html>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks