Imports System.Data.SqlClient
Public Class Profile
Inherits System.Web.UI.Page
Dim Conn As dbConn
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Session("strUserID") = "" Then
Response.Redirect("/login.aspx?r=/Profile.aspx")
Else
Loaddata()
End If
End Sub
Public Sub Loaddata()
Dim strUserID As String = Session("strUserID").ToString()
lblUsername.Text = Conn.GetDataTable("select Username from Account WHERE UserID = '" + strUserID + "'", "Customer").Rows(0)(0).ToString() + " "
lblPassword.Text = Conn.GetDataTable("select Password from Account WHERE UserID = '" + strUserID + "'", "Customer").Rows(0)(0).ToString() + " "
lblName.Text = Conn.GetDataTable("select Username from Account WHERE UserID = '" + strUserID + "'", "Customer").Rows(0)(0).ToString() + " "
lblLastname.Text = Conn.GetDataTable("select Username from Account WHERE UserID = '" + strUserID + "'", "Customer").Rows(0)(0).ToString() + " "
End Sub
End Class
Sub Page_Load(sender As Object, e As EventArgs)
strConnString = "Server=localhost;Uid=sa;PASSWORD=;database=mydatabase;Max Pool Size=400;Connect Timeout=600;"
objConn.ConnectionString = strConnString
objConn.Open()
IF Not Page.IsPostBack() Then
ViewData()
End IF
End Sub
Sub ViewData()
'*** DataTable ***'
Dim dtAdapter As SqlDataAdapter
Dim dt As New DataTable
strSQL = "SELECT * FROM customer WHERE CustomerID = '"& Request.QueryString("CustomerID") &"' "
dtAdapter = New SqlDataAdapter(strSQL, objConn)
dtAdapter.Fill(dt)
If dt.Rows.Count > 0 Then
Me.txtCustomerID.Text = dt.Rows(0)("CustomerID")
Me.txtName.Text = dt.Rows(0)("Name")
Me.txtEmail.Text = dt.Rows(0)("Email")
Me.txtCountryCode.Text = dt.Rows(0)("CountryCode")
Me.txtBudget.Text = dt.Rows(0)("Budget")
Me.txtUsed.Text = dt.Rows(0)("Used")
End IF
End Sub