string sql = string.Format("Select * from ( SELECT dbo.account.id, dbo.account.name, dbo.account.description, dbo.[group].name AS GroupName, dbo.lot_limit.name AS LotLimitName," +
"dbo.money_limit.name AS MoneyLimitName FROM dbo.account INNER JOIN dbo.[group] ON dbo.account.group_id = dbo.[group].id INNER JOIN " +
"dbo.lot_limit ON dbo.[group].id = dbo.lot_limit.group_id INNER JOIN dbo.group_money_limit ON dbo.[group].id = dbo.group_money_limit.group_id INNER JOIN " +
"dbo.money_limit ON dbo.group_money_limit.money_limit_id = dbo.money_limit.id ) where (dbo.account.name like '{0}' or dbo.account.description like '{1}') order by dbo.account.id",
this.TextBox1.Text, this.TextBox1.Text );运行出错说是:
关键字 'where' 附近有语法错误。
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
"dbo.money_limit.name AS MoneyLimitName FROM dbo.account INNER JOIN dbo.[group] ON dbo.account.group_id = dbo.[group].id INNER JOIN " +
"dbo.lot_limit ON dbo.[group].id = dbo.lot_limit.group_id INNER JOIN dbo.group_money_limit ON dbo.[group].id = dbo.group_money_limit.group_id INNER JOIN " +
"dbo.money_limit ON dbo.group_money_limit.money_limit_id = dbo.money_limit.id ) where (dbo.account.name like '{0}' or dbo.account.description like '{1}') order by dbo.account.id",
this.TextBox1.Text, this.TextBox1.Text );运行出错说是:
关键字 'where' 附近有语法错误。
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
为什么要加一个子查询
SELECT dbo.account.id, dbo.account.name, dbo.account.description, dbo.[group].name AS GroupName, dbo.lot_limit.name AS LotLimitName,dbo.money_limit.name AS MoneyLimitName FROM dbo.account INNER JOIN dbo.[group] ON dbo.account.group_id = dbo.[group].id INNER JOIN dbo.lot_limit ON dbo.[group].id = dbo.lot_limit.group_id INNER JOIN dbo.group_money_limit ON dbo.[group].id = dbo.group_money_limit.group_id INNER JOIN dbo.money_limit ON dbo.group_money_limit.money_limit_id = dbo.money_limit.id where dbo.account.name like '{0}' or dbo.account.description like '{1}') order by dbo.account.id
呵呵,^_^
TKS a lot!!!~~~~~~~~~~~~~~