full text search - SQL Statement to check first character for first and last name from textbox -
i trying write sql statement or statements retrieve account information based on textbox entry of person’s initials (last, first). following statement works when enter 1 letter, not too.
'variable dim strdatasource string dim connstr string = "provider=microsoft.jet.oledb.4.0;" & _ "data source = chapter4.mdb" strdatasource = "select custid, lastname, firstname " & _ "from tblcustomers " & _ "where ucase(trim(lastname)) '" & ucase(me.txtcustid.text) & "%'" dim dt new datatable dim dataadapter = new oledb.oledbdataadapter(strdatasource, connstr) dataadapter.fill(dt) dataadapter.dispose() me.dgvdisplay.datasource = dt
i cannot figure out how add firstname search.
i don't know names of fields in form, rajesh suggesting similar following. if want first or last name match, use or instead of , in clause.
strdatasource = "select custid, lastname, firstname " & _ "from tblcustomers " & _ "where ucase(trim(lastname)) '" & ucase(me.txtcustid.text) & "%'" _ , ucase(trim(firstname)) '" & ucase(me.txtfirstname.text)
Comments
Post a Comment