Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Data
- Imports System.Data.SqlClient
- Module Connect
- Public Conn As SqlConnection
- Public Function GetConnect()
- Conn = New SqlConnection("Server = .\SQLExpress;AttachDbFilename=E:\SmartAidDB.mdf;Database=SmartAidDB;Trusted_Connection=Yes;")
- Return Conn
- End Function
- End Module
- Public Class BloodDonor
- Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtState.TextChanged
- End Sub
- Private Sub Label6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label6.Click
- End Sub
- Private Sub Label5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label5.Click
- End Sub
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddNew.Click
- Dim strBloodType As String = txtBloodType.Text
- Dim strDonorName As String = txtDonorName.Text
- Dim strEMail As String = txtEMail.Text
- Dim strPhoneNumber As String = txtPhoneNumber.Text
- Dim strLocation As String = txtLocation.Text
- Dim strState As String = txtState.Text
- Dim strStatus As String = txtStatus.Text
- Dim strIDNumber As String = txtIDNumber.Text
- Dim strCommand As String = "insert into BloodBank values('" & strBloodType & "', '" & strDonorName & "', '" & strEMail & "', '" & strPhoneNumber & "', '" & strLocation & "', '" & strState & "', '" & strStatus & "', '" & strIDNumber & ")"
- Dim Command As SqlClient.SqlCommand = New SqlClient.SqlCommand(strCommand, GetConnect)
- Command.CommandType = CommandType.Text
- '' MsgBox(strCommand)
- Connect.GetConnect()
- Conn.Open()
- Command = New SqlClient.SqlCommand(strCommand, Conn)
- If (Command.ExecuteNonQuery().Equals(1)) Then
- MsgBox("Information Stored In Database")
- Else
- MsgBox("Information Didn't Get Stored In Database")
- End If
- End Sub
- Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
- End Sub
- Private Sub BloodDonor_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement