我在 VB 2008 中使用 TableAdapter 和 LIKE 语句时遇到了一些问题。我想使用部分拼写搜索名称。当我运行应用程序时,什么都没有返回。
这是我的 SQL:
SELECT MEMBERS.RolodexID, MEMBERS.FirstName, MEMBERS.LastName, MEMBERS.address, MEMBERS.Address2, MEMBERS.City, MEMBERS.State,
MEMBERS.Zip, MEMBERS.AreaCode1, MEMBERS.LocalNumber1, MEMBERS.AreaCode2, MEMBERS.LocalNumber2, MEMBERS.AreaCode3,
MEMBERS.LocalNumber3, Member_Employers.Department, Member_Employers.Job_Class, EMPLOYER.NAME, MEMBERS.Industry,
EMPLOYER.CODE
FROM EMPLOYER INNER JOIN
Member_Employers ON EMPLOYER.CODE = Member_Employers.Employer_Code INNER JOIN
MEMBERS AS MEMBERS ON Member_Employers.Rolodexid = MEMBERS.RolodexID
WHERE (MEMBERS.LastName like ?)
这是我的VB代码:
DIM LastName as String
LastName = me.txt_LastName.text
Me.MEMBERSTableAdapter.FillBy(DataSet1.MEMBERS, LastName)
我尝试了其他一些代码,包括:
LastName = "'" & me.txt_LastName.text & "%'"
或者
LastName = me.txt_LastName.text & "%"
请帮忙!