0% found this document useful (0 votes)
20 views3 pages

Blood Group

No

Uploaded by

pjay27470
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views3 pages

Blood Group

No

Uploaded by

pjay27470
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Login :

Imports System.Data
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page

Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs)


Handles LinkButton1.Click
Response.Redirect("~/register.aspx")
End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Button1.Click
Dim cn As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=D:\harsh\PHP\
blood_donate\App_Data\Database.mdf;Integrated Security=True;User Instance=True")
Dim cmd As New SqlCommand("select count(usernm) from blood where usernm='" +
TextBox1.Text + "'and pswd='" + TextBox2.Text + "'", cn)
cn.Open()
Dim count = cmd.ExecuteScalar
cn.Close()
If count > 0 Then
Session("un") = TextBox1.Text
Response.Redirect("~/search.aspx")
Else
MsgBox("invalid username or password")
End If
End Sub
End Class

Register :
Imports System.Data
Imports System.Data.SqlClient
Partial Class register
Inherits System.Web.UI.Page

Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs)


Handles LinkButton1.Click
Response.Redirect("~/login.aspx")
End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Button1.Click
Dim cn As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=D:\harsh\PHP\
blood_donate\App_Data\Database.mdf;Integrated Security=True;User Instance=True")
Dim cmd As New SqlCommand("insert into blood
values(@usernm,@pswd,@name,@email,@mno,@address,@city,@state,@bgp,@ddate)", cn)
cmd.Parameters.AddWithValue("@usernm", TextBox1.Text)
cmd.Parameters.AddWithValue("@pswd", TextBox2.Text)
cmd.Parameters.AddWithValue("@name", TextBox3.Text)
cmd.Parameters.AddWithValue("@email", TextBox4.Text)
cmd.Parameters.AddWithValue("@mno", TextBox5.Text)
cmd.Parameters.AddWithValue("@address", TextBox6.Text)
cmd.Parameters.AddWithValue("@city", TextBox7.Text)
cmd.Parameters.AddWithValue("@state", TextBox8.Text)
cmd.Parameters.AddWithValue("@bgp", DropDownList1.Text)
cmd.Parameters.AddWithValue("@ddate", TextBox10.Text)
cn.Open()
cmd.ExecuteNonQuery()
MsgBox("registered successfully")
Response.Redirect("~/login.aspx")
cn.Close()
End Sub
End Class

Master Page :

Partial Class MasterPage


Inherits System.Web.UI.MasterPage

Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs)


Handles LinkButton1.Click
Response.Redirect("~/search.aspx")
End Sub

Protected Sub LinkButton2_Click(ByVal sender As Object, ByVal e As System.EventArgs)


Handles LinkButton2.Click
Response.Redirect("~/editprofile.aspx")
End Sub

Protected Sub LinkButton3_Click(ByVal sender As Object, ByVal e As System.EventArgs)


Handles LinkButton3.Click
Response.Redirect("~/changepswd.aspx")
End Sub

Protected Sub LinkButton4_Click(ByVal sender As Object, ByVal e As System.EventArgs)


Handles LinkButton4.Click
Server.Transfer("~/login.aspx")
End Sub
End Class

Change Pass :
Imports System.Data
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Button1.Click
Dim cn As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=D:\harsh\PHP\
blood_donate\App_Data\Database.mdf;Integrated Security=True;User Instance=True")
Dim cmd As New SqlCommand("select count(usernm) from blood where usernm='" +
Session("un") + "'and pswd=@pswd", cn)
cmd.Parameters.AddWithValue("pswd", TextBox1.Text)
cn.Open()
Dim chk As Integer = cmd.ExecuteScalar
cn.Close()
If chk > 0 Then
Dim cmdx As New SqlCommand("update blood set pswd='" + TextBox3.Text + "' where
usernm='" + Session("un") + "'", cn)
cn.Open()
cmdx.ExecuteNonQuery()
cn.Close()
MsgBox("pssword changed successfully")
Else
MsgBox("password not same")
End If
End Sub
End Class

Edit Prof :
Imports System.Data
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Me.Load

End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles


Button1.Click
Dim cn As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=D:\harsh\PHP\
blood_donate\App_Data\Database.mdf;Integrated Security=True;User Instance=True")
Dim cmd As New SqlCommand("update blood set mno='" + TextBox1.Text + "',address='" +
TextBox2.Text + "',city='" + TextBox3.Text + "',state='" + TextBox4.Text + "' where usernm='"
+ Session("un") + "'", cn)
Dim chk As Integer
cn.Open()
chk = cmd.ExecuteNonQuery()
cn.Close()
If (chk = 1) Then
MsgBox("info updated")
Else
MsgBox(" some error occured")
End If
End Sub
End Class

You might also like