.ASP webpage & SQL  
Author Message
QWERTYtech





PostPosted: .NET Framework Data Access and Storage, .ASP webpage & SQL Top

I'm pretty sure this is in the wrong place but please let me know where i can post this.

Add User

I recently created a addnewuser.aspx page and I have some fields(as follow):

First Name (txbx)

Last Name (txbx)

Title (txbx)

Office (dropdownlist)

Status (dropdownlist)

Ext. (txbx)

Home Phone (txbx)

Mobile Phone (txbx)

Pager (txbx)

Work Phone (txbx)

email (txbx)

Save(btn) Clear(btn)

I have a database and I want to use SQL to write the data to the database.

Update/Modify

I also want to create a page where someone can pull select an employee from a drop down list and once they select them, the employee's info populates in the txbx's.



.NET Development11  
 
 
ena





PostPosted: .NET Framework Data Access and Storage, .ASP webpage & SQL Top

....looks like you are a starter with ASP.net.

The Microsoft website provides some really good starter kits that will help you learn such tasks

http://msdn.microsoft.com/vstudio/express/vwd/starterkit/#personal

http://www.asp.net/downloads/starterkits/default.aspx tabid=62

other alternates are

http://samples.gotdotnet.com/quickstart/aspplus/doc/

http://samples.gotdotnet.com/quickstart/aspplus/doc/webdataaccess.aspx#sqldata

hope it helps you with your application...good luck !



 
 
QWERTYtech





PostPosted: .NET Framework Data Access and Storage, .ASP webpage & SQL Top

The links you provided me look like they have a great deal of information but I'm still confused as can be.
 
 
CommonGenius.com





PostPosted: .NET Framework Data Access and Storage, .ASP webpage & SQL Top

The only way to figure it out is to try it and see what happens.

 
 
QWERTYtech





PostPosted: .NET Framework Data Access and Storage, .ASP webpage & SQL Top

The following is code that i have pieced together to populate a table with data from my database. What I need to know now is how to populate a dropdownlist with Last Name, First Name . Once someone clicks on a name I want it populate textboxes with corresponding data for that particular person. How would I go about this

<% Page Language="VB" AutoEventWireup="false" CodeFile="phonelist.aspx.vb" Inherits="phonelist" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<% Import Namespace="System.Data.OleDb" %>

<script runat="server">

sub Page_Load

dim dbconn,sql,dbcomm,dbread

dbconn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.MapPath("/App_Data/phonelist.mdf"))

dbconn.Open()

sql = "SELECT (First_Name, Last_Name, Title, extinsion) FROM employees"

dbcomm = New OleDbCommand(sql, dbconn)

dbread = dbcomm.ExecuteReader()

employees.DataSource = dbread

employees.DataBind()

dbread.Close()

dbconn.Close()

End Sub

</script>

<html>

<head><title>PhoneList</title></head>

<body>

<form id="Form1" runat="server">

<asp:Repeater id="employees" runat="server" DataSourceID="SqlDataSource1">

<HeaderTemplate>

<table border="1" width="100%">

<tr bgcolor="#b0c4de">

<th>First Name</th>

<th>Last Name</th>

<th>Title</th>

<th>Ext.</th>

</tr>

</HeaderTemplate>

<ItemTemplate>

<tr bgcolor="#f0f0f0">

<td><%#Container.DataItem("First_Name")%> </td>

<td><%#Container.DataItem("Last_Name")%> </td>

<td><%#Container.DataItem("Title")%> </td>

<td><%#Container.DataItem("extinsion")%> </td>

</tr>

</ItemTemplate>

<FooterTemplate>

</table>

</FooterTemplate>

</asp:Repeater>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:phonelistConnectionString %>"

SelectCommand="SELECT [First Name] AS First_Name, [Last Name] AS Last_Name, [extinsion], [Title] FROM [employees]">

</asp:SqlDataSource>

<asp:DropDownList ID="dropdownlist" runat="server">

<asp:ListItem>Test</asp:ListItem>

</asp:DropDownList>

</form>

</body>

</html>