Question using sql

triper

New member
Joined
Apr 11, 2013
Messages
1
Programming Experience
Beginner
hello i need some help with my school project
i have created a database of business that have a table called tblworkers
i cannot use datagridview
in my windowform i need to have a add/delete/update button in the next way:(i must use the same button for all 3 so i added 3 radio buttons :add/delete/update)
add :
i have 4 textbox(first name, last name, phone number,EmployeeID(the user cannot enter his own EmpolyeeID, i need the data to be sent back from the table to the textbox)

delete:
i have a combo box that alredy shows the names in the table, and by selecting a name a pressing the button i need it to be deleted

update: same as add

i am adding the work i already did
10x if u try to help


VB.NET:
Imports Microsoft.Office.Interop.Excel
Imports System.Data.SqlClient
Imports System.Data


Public Class Workers
    Private cs As New SqlConnection("Data Source=SALMAN-PC\SQLEXPRESS;Initial Catalog=BUSINESS;Integrated Security=True")
    Private da As New SqlDataAdapter("SELECT * FROM tblWorkers", cs)
    Private ds As New DataSet
    Private cmb As New SqlCommand("da", cs)


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        GroupBox1.Visible = True
    End Sub


    Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
        If txtUserID.Text = "" Then
            MsgBox("נא להכניס מספר עובד")
        End If
    End Sub


    Private Sub rdbByEpmloyee_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdbByEpmloyee.CheckedChanged
        If rdbByEpmloyee.Checked = True Then
            Label4.Visible = True
            txtUserIDReport.Visible = True
        ElseIf rdbByEpmloyee.Checked = False Then
            Label4.Visible = False
            txtUserIDReport.Visible = False
        End If
    End Sub




    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If rdbAddEmployee.Checked = True Then
            MsgBox("העובד" + " " + txtName.Text + " " + txtFamilyName.Text + " " + "התווסף לצוות העובדים")
        ElseIf rdbDeleteEmployee.Checked = True Then
            MsgBox("העובד" + " " + txtName.Text + " " + txtFamilyName.Text + " " + "נמחק מצוות העובדים")
        End If
    End Sub


    Private Sub rdbAddEmployee_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdbAddEmployee.CheckedChanged
        If rdbAddEmployee.Checked = True Then
            GroupBox2.Visible = True
        Else
            GroupBox2.Visible = False
        End If
    End Sub


    Private Sub rdbDeleteEmployee_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdbDeleteEmployee.CheckedChanged
        If rdbDeleteEmployee.Checked = True Then
            GroupBox3.Visible = True
        Else
            GroupBox3.Visible = False
        End If
    End Sub


    Private Sub Workers_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'BUSINESSDataSet.tblWorkers' table. You can move, or remove it, as needed.
        Me.TblWorkersTableAdapter.Fill(Me.BUSINESSDataSet.tblWorkers)
        'TODO: This line of code loads data into the 'BUSINESSDataSet.tblWorkers' table. You can move, or remove it, as needed.
        Me.TblWorkersTableAdapter.Fill(Me.BUSINESSDataSet.tblWorkers)


    End Sub
End Class
 

Attachments

  • front.png
    front.png
    179.1 KB · Views: 25
Back
Top