SHARE
TWEET

Untitled

a guest Feb 21st, 2019 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.     '====test number of bottles=============
  3.     Dim bottlecount As Integer 'variable used in order to increase the value of no. of bottle/s used
  4.  
  5.     bottlecount = Form3.lblBottle.Text
  6.     bottlecount += 1
  7.     Form3.lblBottle.Text = bottlecount
  8.  
  9.     roomhold = 1
  10.  
  11.     Dim statement As String = "UPDATE tblPatientInfo SET bottle_used='" & bottlecount & "' WHERE room_number= '" & roomhold & "' ORDER BY ID ;"
  12.     Dim cmd As New OleDbCommand
  13.  
  14.     With cmd
  15.         .CommandText = statement
  16.         .Connection = Conn
  17.         Conn.Open()
  18.         .ExecuteNonQuery()
  19.     End With
  20.     Conn.Close()
  21.  
  22. End Sub
  23.    
  24. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  25.  
  26.     Dim bottlecount As Integer = CInt(Form3.lblBottle.Text) + 1
  27.     Form3.lblBottle.Text = bottlecount
  28.  
  29.     roomhold = 1
  30.  
  31.     Dim statement As String = "UPDATE tblPatientInfo SET bottle_used = @bottlecount"
  32.     statement &= "WHERE room_number = @roomhold"
  33.  
  34.      Dim cmd As New OleDbCommand
  35.  
  36.     With cmd
  37.  
  38.         .Connection = Conn
  39.         .CommandType = CommandType.Text
  40.         .CommandText = statement
  41.         .Parameters.AddWithValue("@bottlecount", bottlecount)
  42.         .Parameters.AddWithValue("@roomhold", roomhold)
  43.         Conn.Open()
  44.         .ExecuteNonQuery()
  45.     End With
  46.    
  47. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  48.     Dim bottlecount As Integer = cint(Form3.lblBottle.Text) + 1
  49.     Form3.lblBottle.Text = bottlecount
  50.  
  51.     Dim roomhold AS Integer = 1
  52.  
  53.     Dim statement As String = "UPDATE tblPatientInfo SET bottle_used = @bottlecount "
  54.     statement &= "WHERE room_number = @roomhold  "
  55.     Using conn as New SqlConnection("ConnectionStringHere")
  56.         Using comm as New SqlCommand()
  57.             With comm
  58.                 .Connection = conn
  59.                 .CommandType = CommandType.Text
  60.                 .CommandText = statement
  61.                 .Parameters.AddWithValue("@bottlecount", bottlecount )
  62.                 .Parameters.AddWithValue("@roomhold" , roomhold)
  63.             End With
  64.             Try
  65.                 conn.Open()
  66.                 comm.ExecuteNonQuery()
  67.             Catch (ex as SQlException)
  68.                 ' add message here '
  69.             Finally
  70.                 conn.Close()
  71.             End Try
  72.         End Using
  73.     End Using
  74. End Sub
  75.    
  76. Dim statement As String = "UPDATE tblPatientInfo SET bottle_used='" & bottlecount & "' WHERE room_number= '" & roomhold & "'"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top