我正在使用 Visual Studio2010,使用 asp.net。我希望查询像示例一样工作,但我的不起作用!
我在数据库中有这些行:
Fullname=joe.address=earth,work=5656,home=23,mobile=55
Fullname=Michel.address=earth,work=5,home=2343,mobile=5435
用户只需输入:
Fullname=joe ,address=earth
程序应该只返回第一行。0 是文本框的默认值。
SELECT fullName, address, work, home, mobile, registrationNo
FROM contacts
WHERE (fullName = @fullName OR fullName = '0')
AND (address = @address OR address = '0')
AND (work = @work OR work = '0')
AND (home = @home OR home = '0')
AND (mobile = @mobile OR mobile = '0')