HI,
Im very new to this…(3 days new) any help would be great! I’m having trouble figuring out how to auto populate data from my sql database.
issue, In the website i have a “product code” text box… once the user inputs a “product code” I’d like to have it auto-fill 3 other (ie, description, location and type) text boxes based on data in the database for that “product code”
any ideas? i can post the code i have now if that helps?
Thanks in advance!
http://www5.brinkster.com/hiflyer/db/dbtest.asp <<< Starter for 10 on manipulating databases with ASP. (Tutorial is based around Access, but can be easily tweaked for other databases).
All you then really need is to:
-
pass the product code to an ASP page where you want to display the information (The page where you enter the product code has a <form> and the action=“” part is the ASP page).
-
Get the product code in the ASP page … sProdCode = Request.Form(“ProductCode”) or sProdCode = Request.Form(“ProductCode”) [depending on the form method being POST or GET]
-
Run a SQL query on the database based on sProdCode
-
Get the returned field data
-
Populate the data into textareas … <textarea name=“something”><% =FieldData %></textarea>
Have a play with this, then when/if you get stuck come back with your code and we’ll help more. 
Thanks for the Response… below is what i have so far… I know Ive made errors… IM not to sure if or when I might need to use “insert” or “Where” please advise! thanks!
<form method="post" action="productcode.asp">
Product Code: <input type="text" name="ProductCode" /><br />
<input type="submit" value="Submit" />
</form>
<%
sProdCode = Request.Form("ProductCode")
%>
<asp:SqlDataSource ID="Productcode" runat="server" ConnectionString="<%$ ConnectionStrings:WWWaste %>"
SelectCommand="SELECT Product Description, Facility, Technology>
<textarea name="Product_description"><% =FieldData %></textarea>
<textarea name="Facility"><% =FieldData %></textarea>
<textarea name="Technology"><% =FieldData %></textarea>
<InsertItemTemplate>
<span style="font-size: 9pt;color:#000000;font-weight:bold;">Add Unit/Product:</span>
<span style="font-size: 8pt">
<table style="font-size: 8pt">
<tr>
<td style="width: 100px; height: 21px">
Product Code:</td>
<td style="width: 100px; height: 21px">
<asp:TextBox ID="Product_code" runat="server" Text='<%# Bind("Product Code") %>'></asp:TextBox></td>
</td>
</tr>
<tr>
<td style="width: 100px; height: 21px">
Product Description:</td>
<td style="width: 100px; height: 21px">
<asp:TextBox ID="Product_description" runat="server" Text='<%# Bind("Product Description") %>'></asp:TextBox></td>
</tr>
<tr>
<td style="width: 100px">
Facility:</td>
<td style="width: 100px">
<asp:TextBox ID="Facility" runat="server" Text='<%# Bind("Facility") %>'></asp:TextBox></td>
</tr>
<tr>
<td style="width: 100px">
Technology:</td>
<td style="width: 100px">
<asp:TextBox ID="Technology" runat="server" Text='<%# Bind("Technology") %>'></asp:TextBox></td>
</tr>
<tr>
<td style="width: 100px; height: 21px">
Service Term:</td>
<td style="width: 100px; height: 21px">
<asp:DropDownList ID="fvddServiceTerm" runat="server" DataSourceID="fvdsServiceTerm"
DataTextField="Service_Term" DataValueField="Service_Term_ID">
</asp:DropDownList>
</td>
</tr>
<tr>
<td style="width: 100px">
Last Service:</td>
<td style="width: 100px">
<asp:DropDownList ID="fvddLastService" runat="server" DataSourceID="fvdsLastService"
DataTextField="Last_Service" DataValueField="Last_Service_ID">
</asp:DropDownList>
</tr>
<tr>
<td style="width: 100px">
Qty:</td>
<td style="width: 100px">
<asp:TextBox ID="QtyTextBox" runat="server" Text='<%# Bind("Qty") %>'></asp:TextBox></td>
</tr>
<tr>
<td style="width: 100px">
Tax:</td>
<td style="width: 100px">
<asp:CheckBox ID="TaxCheckBox" runat="server" Checked='<%# Bind("Tax") %>' /></td>
</tr>
<tr>
<td style="width: 100px">
Unit Price:</td>
<td style="width: 100px">
<asp:TextBox ID="Unit_PriceTextBox" runat="server" Text='<%# Bind("Unit_Price") %>'></asp:TextBox></td>
</tr>
</table>
</span>
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
Text="Insert" Font-Size="8pt"></asp:LinkButton>
<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
Text="Cancel" Font-Size="8pt"></asp:LinkButton>
</InsertItemTemplate>
</asp:FormView>
<asp:HiddenField ID="hfServiceTermID" runat="server" />
<asp:HiddenField ID="hfLastServiceID" runat="server" />
</div>
</asp:Content>
This looks like ASP.NET. Wrong forum, sorry. 