Call connect()
Dim sb As New StringBuilder()
sb.Remove(0, sb.Length)
sb.Append("SELECT jobs.*, member.mem_sname, cars.*, colorcars.colorcar_name, typecars.typecar_name, employee.*, position.pos_name FROM jobs INNER JOIN member ON jobs.mem_id = member.mem_id INNER JOIN cars ON jobs.cars_id = cars.cars_id INNER JOIN colorcars ON cars.colorcar_id = colorcars.colorcar_id INNER JOIN typecars ON cars.typecar_id = typecars.typecar_id INNER JOIN employee ON jobs.emp_id = employee.emp_id INNER JOIN position ON employee.pos_id = position.pos_id")
sb.Append(" WHERE (jobs_id=@jobs_id)")
Dim sqlmember As String = sb.ToString()
Dim com As New SqlCommand()
Dim dr As SqlDataReader
With com
.CommandType = CommandType.Text
.CommandText = sqlmember
.Connection = Conn
.Parameters.Clear()
.Parameters.Add("jobs_id", SqlDbType.VarChar).Value = TextBox1.Text.ToString()
dr = .ExecuteReader()
If dr.HasRows Then
dr.Read()
DateTimePicker2.Value = dr.GetValue(dr.GetOrdinal("jobs_date"))
Label38.Text = dr.GetString(dr.GetOrdinal("mem_sname"))
Label25.Text = dr.GetString(dr.GetOrdinal("cars_number"))
Label35.Text = dr.GetString(dr.GetOrdinal("typecar_name"))
Label33.Text = dr.GetString(dr.GetOrdinal("colorcar_name"))
Label24.Text = dr.GetString(dr.GetOrdinal("emp_sname"))
Label30.Text = dr.GetString(dr.GetOrdinal("pos_name"))
Label40.Text = dr.GetValue(dr.GetOrdinal("total"))
Else
MessageBox.Show("ไม่พบข้อมูล !!!", "ผลการตรวจสอบ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
TextBox1.Text = ""
TextBox1.Focus()
End If
End With