How to search base on staff name and no?

jue

Member
Joined
Apr 1, 2005
Messages
11
Programming Experience
Beginner
hi.. i have problem here. How to search staff info base on staff name and staff no? staff info will out in datagrid.
here is sample my coding.

Private Sub searchstaffdetail()

Dim connString As New ConnectionString()

Dim oleConn As OleDb.OleDbConnection

Dim areaData As OleDb.OleDbDataAdapter

Dim recSet As New DataSet()

Dim strCon As String

Dim strSQL As String

Dim intCount As String

strCon = connString.connIHD

strSQL = " select staff_no, name, dept, section " _

& " from PMO_staff_info order by name "



If Trim(txtstaffname.Text) <> "" Then

strSQL = strSQL & " and lower(name) like '%" & txtstaffname.Text.ToLower & "%'"

''If Trim(txtstaffno.Text) <> "" Then

'' strSQL = strSQL & " and staff_no = " & CInt(txtstaffno.Text) & ""

'' 'ElseIf Trim(txtIC.Text) <> "" Then

' strSQL = strSQL & " and staff_ic = " & CInt(txtIC.Text) & ""

End If

strSQL = strSQL & " order by name "

areaData =
New OleDbDataAdapter(strSQL, strCon)

areaData.Fill(recSet, "staffinfo")

intCount = recSet.Tables(0).Rows.Count

'If intCount > 0 Then

dgstaffinfo.DataSource = recSet

dgstaffinfo.DataBind()

dgstaffinfo.Visible =
True

lblmessageerror.Visible = False

'lblmessageerror.Visible = True

lblmessageerror.Text = "No record found."

'dgstaffinfo.Visible = False

'End If

End Sub

Private Sub btnsearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsearch.Click

Me.searchstaffdetail()

End Sub

End
Class

Please anyone help me.
 
Back
Top