Advertisement
SaadKerkuklu

Code Debug!

Mar 15th, 2013
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports System.Data
  2. Imports System.Data.SqlClient
  3.  
  4. Module Connect
  5.     Public Conn As SqlConnection
  6.  
  7.     Public Function GetConnect()
  8.  
  9.         Conn = New SqlConnection("Server = .\SQLExpress;AttachDbFilename=E:\SmartAidDB.mdf;Database=SmartAidDB;Trusted_Connection=Yes;")
  10.         Return Conn
  11.  
  12.     End Function
  13. End Module
  14. Public Class BloodDonor
  15.  
  16.     Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtState.TextChanged
  17.  
  18.     End Sub
  19.     Private Sub Label6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label6.Click
  20.  
  21.     End Sub
  22.  
  23.     Private Sub Label5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label5.Click
  24.  
  25.     End Sub
  26.  
  27.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddNew.Click
  28.         Dim strBloodType As String = txtBloodType.Text
  29.         Dim strDonorName As String = txtDonorName.Text
  30.         Dim strEMail As String = txtEMail.Text
  31.         Dim strPhoneNumber As String = txtPhoneNumber.Text
  32.         Dim strLocation As String = txtLocation.Text
  33.         Dim strState As String = txtState.Text
  34.         Dim strStatus As String = txtStatus.Text
  35.         Dim strIDNumber As String = txtIDNumber.Text
  36.  
  37.         Dim strCommand As String = "insert into BloodBank values('" & strBloodType & "', '" & strDonorName & "', '" & strEMail & "', '" & strPhoneNumber & "', '" & strLocation & "', '" & strState & "', '" & strStatus & "', '" & strIDNumber & ")"
  38.  
  39.         Dim Command As SqlClient.SqlCommand = New SqlClient.SqlCommand(strCommand, GetConnect)
  40.         Command.CommandType = CommandType.Text
  41.  
  42.         '' MsgBox(strCommand)
  43.  
  44.         Connect.GetConnect()
  45.         Conn.Open()
  46.         Command = New SqlClient.SqlCommand(strCommand, Conn)
  47.         If (Command.ExecuteNonQuery().Equals(1)) Then
  48.             MsgBox("Information Stored In Database")
  49.         Else
  50.             MsgBox("Information Didn't Get Stored In Database")
  51.         End If
  52.     End Sub
  53.  
  54.     Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
  55.  
  56.  
  57.  
  58.     End Sub
  59.  
  60.     Private Sub BloodDonor_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  61.  
  62.     End Sub
  63. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement