PageRenderTime 33ms CodeModel.GetById 27ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/e_desk/addhduser.aspx.vb

http://github.com/shafiqissani/eDesk-Systems
Visual Basic | 67 lines | 49 code | 14 blank | 4 comment | 0 complexity | d913ae6d040a1714867394f581fd3bc4 MD5 | raw file
 1Imports System
 2Imports System.Data.SqlClient
 3
 4Namespace e_desk
 5
 6Partial Class addhduser
 7    Inherits System.Web.UI.Page
 8
 9#Region " Web Form Designer Generated Code "
10
11    'This call is required by the Web Form Designer.
12    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
13
14    End Sub
15
16
17    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
18        'CODEGEN: This method call is required by the Web Form Designer
19        'Do not modify it using the code editor.
20        InitializeComponent()
21    End Sub
22
23#End Region
24
25    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
26        'Put user code to initialize the page here
27    End Sub
28
29    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
30        Dim s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, str As String
31        s1 = t1.Text
32        s2 = t2.Text
33        s3 = t3.Text
34        s4 = t4.Text
35        s5 = t5.Text
36        s6 = t6.Text
37        s7 = t7.Text
38        s8 = t8.Text
39        s9 = t9.Text
40        s10 = t10.Text
41        s11 = t11.Text
42        s12 = t12.SelectedItem.Value
43        s13 = t13.Text
44
45        Dim con As SqlConnection = New SqlConnection("Server=(local);uid=sa;database=eDesk")
46        con.Open()
47
48        Dim dr As SqlDataReader
49        Dim cmd As SqlCommand
50
51        str = "select * from registration where userid='" + s10 + "'"
52        cmd = New SqlCommand(str, con)
53        dr = cmd.ExecuteReader()
54        If dr.Read Then
55            Response.Write("user id is already exist.. Please give another user id")
56        Else
57            con.Close()
58            con.Open()
59            str = "insert into registration values('" + s1 + "','" + s2 + "','" + s3 + "','" + s4 + "','" + s5 + "','" + s6 + "','" + s7 + "','" + s8 + "','" + s9 + "','" + s10 + "','" + s11 + "','" + s12 + "','" + s13 + "','hd user')"
60            cmd = New SqlCommand(str, con)
61            cmd.ExecuteNonQuery()
62            Response.Write("Record inserted")
63        End If
64    End Sub
65End Class
66
67End Namespace