-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuaccount.aspx.vb
77 lines (50 loc) · 2.23 KB
/
uaccount.aspx.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
Imports System.Data
Imports System.Data.Sql
Imports System.Drawing
Imports System.Data.SqlClient
Imports System.Configuration
Partial Class changepass
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If (Not (IsPostBack)) Then
Dim con As SqlConnection
con = New SqlConnection("Data Source=SHUBHAM\SRKING;Initial Catalog=carrentals;Integrated Security=True")
con.Open()
Dim query As String
query = "select * from regis where u_id=" & Session("u_id")
Dim cmd As New SqlCommand(query, con)
Dim da As SqlDataAdapter
da = New SqlDataAdapter(cmd)
Dim dt As New DataTable
da.Fill(dt)
If dt.Rows.Count > 0 Then
txtfirst.Text = dt.Rows(0)(1)
txtlast.Text = dt.Rows(0)(2)
txtaddress.Text = dt.Rows(0)(3)
txtpostcode.Text = dt.Rows(0)(4)
txtcontact.Text = dt.Rows(0)(5)
txtpass.Text = dt.Rows(0)(8)
txtemail.Text = dt.Rows(0)(7)
End If
con.Close()
End If
End Sub
Protected Sub Btnsubmit_Click(sender As Object, e As EventArgs) Handles Btnsubmit.Click
Dim con As New SqlConnection("Data Source=SHUBHAM\SRKING;Initial Catalog=carrentals;Integrated Security=True")
con.Open()
Dim str As String
str = "Update regis set firstname=@fn,lastname=@ln,address=@address,postcode=@postcode,contact=@contact,email=@mail,pass_word=@p where u_id=" & Session("u_id")
Dim cmd As New SqlCommand(str, con)
cmd.Parameters.AddWithValue("@fn", txtfirst.Text)
cmd.Parameters.AddWithValue("@ln", txtlast.Text)
cmd.Parameters.AddWithValue("@address", txtaddress.Text)
cmd.Parameters.AddWithValue("@postcode", txtpostcode.Text)
cmd.Parameters.AddWithValue("@contact", txtcontact.Text)
cmd.Parameters.AddWithValue("@mail", txtemail.Text)
cmd.Parameters.AddWithValue("@p", txtpass.Text)
cmd.ExecuteNonQuery()
con.Close()
lblMessage.ForeColor = Color.Green
lblMessage.Text = "Updated."
End Sub
End Class