<%@ Page LANGUAGE="VB" MasterPageFile="~/MasterPage.master" Title="The Car Masseuse - Profile Update" %>
<%@Import Namespace="System.Web.Security" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Data" %>
<script runat="server">
Protected Sub Page_Load(ByVal sender AS Object, ByVal e AS System.EventArgs)
Dim myConnection AS New SqlConnection("server=localhost;uid=###;pwd=###;database=###;")
Dim myCommand AS New SqlDataAdapter("select * from users where username='" & Request.Cookies("username").Value & "'", myConnection)
Dim ds AS New DataSet()
myCommand.Fill(ds, "users")
lblID.Text = ds.TABLES(0).Rows(0)("id").ToString()
txtName.Text = ds.TABLES(0).Rows(0)("name").ToString()
txtAdd.Text = ds.TABLES(0).Rows(0)("address").ToString()
txtCity.Text = ds.TABLES(0).Rows(0)("City").ToString()
txtSt.Text = ds.TABLES(0).Rows(0)("st").ToString()
txtZIP.Text = ds.TABLES(0).Rows(0)("zip").ToString()
txtPhone.Text = ds.TABLES(0).Rows(0)("phone").ToString()
txtEmail.Text = ds.TABLES(0).Rows(0)("email").ToString()
End Sub
Protected Sub butUpdate_Click(ByVal sender AS Object, ByVal e AS System.EventArgs)
Dim sqlConn AS SqlConnection = New SqlConnection("server=localhost;uid=###;pwd=###;database=###;")
Dim sqlSel AS SqlCommand
sqlSel = New SqlCommand
sqlSel.Connection = sqlConn
sqlSel.CommandText = "userUpdate"
sqlSel.CommandType = DATA.CommandType.StoredProcedure
sqlSel.Parameters.AddWithValue("@id", lblID.Text)
sqlSel.Parameters.AddWithValue("@name", txtName.Text)
sqlSel.Parameters.AddWithValue("@address", txtAdd.Text)
sqlSel.Parameters.AddWithValue("@city", txtCity.Text)
sqlSel.Parameters.AddWithValue("@st", txtSt.Text)
sqlSel.Parameters.AddWithValue("@zip", txtZIP.Text)
sqlSel.Parameters.AddWithValue("@phone", txtPhone.Text)
sqlSel.Parameters.AddWithValue("@email", txtEmail.Text)
Dim selParm AS SqlParameter = sqlSel.Parameters.ADD("ReturnValue", SqlDbType.Int, 1)
selParm.Direction = ParameterDirection.ReturnValue
sqlConn.Open()
sqlSel.ExecuteNonQuery()
IF selParm.Value = 0 Then
lblstatus.Text = "Update Sucessful!"
Panel1.Visible = False
End IF
sqlConn.Close()
End Sub
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table align="center" width="545px"><tr><td align="right" class="texttitle1">Update Profile</td></tr><tr><td><hr color="#F53167" /></td></tr>
<tr><td>
<asp:Label ID="lblstatus" runat="server">Here you can UPDATE your contact information.</asp:Label>
<asp:Panel ID="Panel1" runat="server">
<asp:Label runat="server" ID="lblUserId">User ID #:</asp:Label><asp:Label runat="server" ID="lblID"></asp:Label><br />
<asp:Label runat="server" ID="lblName">Name: </asp:Label><asp:TextBox ID="txtName" runat="server" cssclass="text"></asp:TextBox><br />
<asp:Label runat="server" ID="lblAddress">Address: </asp:Label><asp:TextBox ID="txtAdd" runat="server" cssclass="text"></asp:TextBox><br />
<asp:Label runat="server" ID="lblCity">City: </asp:Label><asp:TextBox ID="txtCity" runat="server" cssclass="text"></asp:TextBox><br />
<asp:Label runat="server" ID="lblState">State: </asp:Label><asp:TextBox ID="txtSt" runat="server" cssclass="text"></asp:TextBox><br />
<asp:Label runat="server" ID="lblZip">Zip Code: </asp:Label><asp:TextBox ID="txtZIP" runat="server" cssclass="text"></asp:TextBox><br />
<asp:Label runat="server" ID="lblPhone">Phone Number: </asp:Label><asp:TextBox ID="txtPhone" runat="server" cssclass="text"></asp:TextBox><br />
<asp:Label runat="server" ID="lblEmail">Email: </asp:Label><asp:TextBox ID="txtEmail" runat="server" cssclass="text"></asp:TextBox><br />
<asp:Button ID="butUpdate" runat="server" Text="Update Profile" OnClick="butUpdate_Click" /></asp:Panel></td></tr></table>
</asp:Content>