Advertisement
stronk_8s

yash vb

Mar 22nd, 2023 (edited)
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 7.58 KB | Source Code | 0 0
  1. Login
  2.  
  3.  
  4. Imports System.Data.OracleClient
  5. Imports System.IO
  6. Public Class login
  7.     Dim con As New OracleConnection("Data Source=XE;Persist Security Info=True;User ID=system;Password=ext1;Unicode=True")
  8.     Dim ds As New DataSet
  9.     Dim dr As OracleDataReader
  10.     Dim adp As OracleDataAdapter
  11.     Dim sql As String
  12.     Dim cmd As OracleCommand
  13.     Dim x As Integer
  14.     Private Sub signup_Click(sender As Object, e As EventArgs) Handles signup.Click
  15.         Dim s As New reg
  16.         s.Show()
  17.     End Sub
  18.  
  19.     Private Sub login_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  20.  
  21.     End Sub
  22.  
  23.     Private Sub log_Click(sender As Object, e As EventArgs) Handles log.Click
  24.         If user.Text = "" Then
  25.             MsgBox("Username field is cant be empty")
  26.  
  27.         ElseIf pass.Text = "" Then
  28.             MsgBox("Password field is cant be empty")
  29.         End If
  30.  
  31.         ds.Tables.Clear()
  32.         sql = "select * from login where u_id='" & user.Text & "' and pass='" & pass.Text & "'"
  33.  
  34.         adp = New OracleDataAdapter(sql, con)
  35.         con.Open()
  36.         adp.Fill(ds)
  37.         con.Close()
  38.  
  39.  
  40.         If (ds.Tables(0).Rows.Count > 0) Then
  41.             If user.Text = "admin" Then
  42.                 Dim wel As New leave
  43.                 wel.Show()
  44.  
  45.             ElseIf user.Text.ToString = user.Text Then
  46.                 Dim f As New appli
  47.                 f.Show()
  48.                 Me.Hide()
  49.  
  50.         End If
  51.  
  52.         Else
  53.             MsgBox("No record found")
  54.         End If
  55.  
  56.  
  57.  
  58.         'user.Text = ""
  59.         'pass.Text = ""
  60.  
  61.     End Sub
  62. End Class
  63.  
  64.  
  65.  
  66.  
  67.  
  68. registration
  69.  
  70.  
  71.  
  72.  
  73.  
  74. Imports System.Data.OracleClient
  75. Imports System.IO
  76. Public Class reg
  77.     Dim con As New OracleConnection("Data Source=XE;Persist Security Info=True;User ID=system;Password=ext1;Unicode=True")
  78.     Dim ds As New DataSet
  79.     Dim adp As OracleDataAdapter
  80.     Dim sql As String
  81.     Dim cmd As OracleCommand
  82.     Dim res As Integer
  83.     Private Sub reg_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  84.  
  85.     End Sub
  86.  
  87.     Private Sub clear_Click(sender As Object, e As EventArgs) Handles clear.Click
  88.         user1.Clear()
  89.         pass1.Clear()
  90.         rpass.Clear()
  91.     End Sub
  92.  
  93.     Private Sub signup_Click(sender As Object, e As EventArgs) Handles signup.Click
  94.         If user1.Text = "" Then
  95.             MsgBox("Username field is cant be empty")
  96.  
  97.         ElseIf pass1.Text = "" Then
  98.             MsgBox("Password field is cant be empty")
  99.  
  100.         ElseIf pass1.Text.ToString.Length < 6 Then
  101.             MsgBox("Pasword length is has tobe 6char  ")
  102.  
  103.         ElseIf rpass.Text = "" Then
  104.             MsgBox("Password field is cant be empty")
  105.  
  106.         ElseIf pass1.Text <> rpass.Text Then
  107.             MsgBox("Password is not same")
  108.  
  109.         Else
  110.             sql = "insert into login values('" & user1.Text & "','" & pass1.Text & "')"
  111.  
  112.             cmd = New OracleCommand(sql, con)
  113.             MsgBox("register sucess")
  114.             con.Open()
  115.             res = cmd.ExecuteNonQuery()
  116.             con.Close()
  117.             Me.Close()
  118.  
  119.         End If
  120.     End Sub
  121. End Class
  122.  
  123.  
  124.  
  125.  
  126.  
  127. search
  128.  
  129.  
  130.  
  131.  
  132.  
  133. Imports System.Data.OracleClient
  134. Imports System.IO
  135. Public Class Form2
  136.     Dim con As New OracleConnection("Data Source=XE;Persist Security Info=True;User ID=system;Password=ext1;Unicode=True")
  137.     Dim ds As New DataSet
  138.     Dim adp As OracleDataAdapter
  139.     Dim sql As String
  140.     Dim cmd As OracleCommand
  141.     Dim x As Integer
  142.     Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  143.         sql = "select * from leave_app where status='y'"
  144.         adp = New OracleDataAdapter(sql, con)
  145.         con.Open()
  146.         adp.Fill(ds)
  147.         con.Close()
  148.         data2.DataSource = ds.Tables(0)
  149.  
  150.  
  151.     End Sub
  152.  
  153.     Public Sub find()
  154.         ds.Tables.Clear()
  155.         sql = "select * from leave_app where u_id=" & u_id.Text & ""
  156.  
  157.         adp = New OracleDataAdapter(sql, con)
  158.         con.Open()
  159.         adp.Fill(ds)
  160.         con.Close()
  161.         data2.DataSource = ds.Tables(0)
  162.     End Sub
  163.  
  164.     Private Sub search_Click(sender As Object, e As EventArgs) Handles search.Click
  165.         find()
  166.     End Sub
  167.  
  168.     Private Sub u_id_TextChanged(sender As Object, e As EventArgs) Handles u_id.TextChanged
  169.  
  170.     End Sub
  171. End Class
  172.  
  173.  
  174.  
  175.  
  176. application
  177.  
  178.  
  179.  
  180. Imports System.Data.OracleClient
  181. Imports System.IO
  182. Public Class appli
  183.     Dim con As New OracleConnection("Data Source=XE;Persist Security Info=True;User ID=system;Password=ext1;Unicode=True")
  184.     Dim ds As New DataSet
  185.     Dim dr As OracleDataReader
  186.     Dim adp As OracleDataAdapter
  187.     Dim sql As String
  188.     Dim cmd As OracleCommand
  189.     Dim rese As Integer
  190.  
  191.     Private Sub logout_Click(sender As Object, e As EventArgs) Handles logout.Click
  192.         Dim w As New login
  193.         w.Show()
  194.     End Sub
  195.  
  196.     Dim x As Integer
  197.     Dim op As OpenFileDialog
  198.     Private Sub submit_Click(sender As Object, e As EventArgs) Handles submit.Click
  199.         If user2.Text = "" Then
  200.             MsgBox("Please Enter username")
  201.         ElseIf dept.SelectedItem = "" Then
  202.             MsgBox("please select department")
  203.  
  204.         ElseIf res.Text = "" Then
  205.             MsgBox("Please enter reason")
  206.  
  207.         ElseIf day.Text = "" Then
  208.  
  209.             MsgBox("Please enter no of days")
  210.  
  211.         Else
  212.             sql = "insert into leave_app values('" & user2.Text & "','" & dept.SelectedItem & "','" & res.Text & "','" & day.Text & "','n')"
  213.  
  214.             cmd = New OracleCommand(sql, con)
  215.             MsgBox("Aplication submited sucessfully")
  216.             con.Open()
  217.             rese = cmd.ExecuteNonQuery()
  218.             con.Close()
  219.             user2.Clear()
  220.             res.Clear()
  221.             day.Clear()
  222.  
  223.         End If
  224.  
  225.     End Sub
  226.  
  227.     Private Sub dept_SelectedIndexChanged(sender As Object, e As EventArgs) Handles dept.SelectedIndexChanged
  228.  
  229.     End Sub
  230.  
  231.  
  232.  
  233.     Private Sub clist_Click(sender As Object, e As EventArgs) Handles clist.Click
  234.         Dim w As New Form2
  235.         w.Show()
  236.     End Sub
  237. End Class
  238.  
  239.  
  240.  
  241.  
  242. leave
  243.  
  244.  
  245.  
  246.  
  247. Imports System.Data.OracleClient
  248. Imports System.IO
  249. Public Class leave
  250.     Dim con As New OracleConnection("Data Source=XE;Persist Security Info=True;User ID=system;Password=ext1;Unicode=True")
  251.     Dim ds As New DataSet
  252.     Dim adp As OracleDataAdapter
  253.     Dim sql As String
  254.     Dim cmd As OracleCommand
  255.     Dim x As Integer
  256.     Dim r As Integer
  257.     Private Sub leave_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  258.         sql = "select * from leave_app"
  259.         adp = New OracleDataAdapter(sql, con)
  260.         con.Open()
  261.         adp.Fill(ds)
  262.         con.Close()
  263.  
  264.         data.DataSource = ds.Tables(0)
  265.     End Sub
  266.     Public Sub fillgrid()
  267.         ds.Tables.Clear()
  268.         sql = "select * from leave_app"
  269.         adp = New OracleDataAdapter(sql, con)
  270.  
  271.         con.Open()
  272.         adp.Fill(ds)
  273.         con.Close()
  274.  
  275.         r = ds.Tables(0).Rows.Count
  276.         data.DataSource = ds.Tables(0)
  277.     End Sub
  278.     Private Sub submit_Click(sender As Object, e As EventArgs) Handles submit.Click
  279.         fillgrid()
  280.         sql = "update leave_app set status = 'y'where u_id =" & app.Text & ""
  281.         cmd = New OracleCommand(sql, con)
  282.         con.Open()
  283.         x = cmd.ExecuteNonQuery()
  284.         con.Close()
  285.  
  286.         If (x > 0) Then
  287.  
  288.             MsgBox("data update")
  289.  
  290.         End If
  291.         fillgrid()
  292.     End Sub
  293.  
  294.     Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  295.         Dim y As New login
  296.         y.Show()
  297.     End Sub
  298.  
  299.     Private Sub app_TextChanged(sender As Object, e As EventArgs) Handles app.TextChanged
  300.  
  301.     End Sub
  302. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement