C#,sql2005:select * from [dbo].[xxx] where username='{0}';取不到任何数据,是为什么?

表是存在的,数据也是存在的,单条数据检索是可以检索到的,请大神解答一下小菜鸟

    这是一个带参数的SQL语句

    跟踪SQL语句,SQL最终被执行的时候,是什么样子

    或者可以使用SQL事件探查器,监视被执行的SQL语句是什么

能看到最终被执行的SQL语句,就应该知道为什么没数据了

追问

如何用一个SQL语句查询表内所有记录:
select * from [dbo].[xxx] where username=???
怎么写可以实现呢?
???应该怎么写

追答

    select * from [dbo].[xxx] where username=username

或者

    select * from [dbo].[xxx]

    select * from [dbo].[xxx] where 1=1

温馨提示:答案为网友推荐,仅供参考
第1个回答  2018-09-02
select * from [dbo].[xxx] where username=???

select * from [dbo].[xxx] where username='" & AA & "' ; '其中AA是你需要查询的变量值,例如 AA = "用户",那么执行后 select * from [dbo].[xxx] where username='用户' 。

相关了解……

你可能感兴趣的内容

大家正在搜

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网