急 在线等待! 高手请进

gq198718 2010-12-08 03:33:05
public DataTable SearchProduct(string Region,string ProductName, string Manufacturer)
{
string strSql = string.Empty;
strSql = "SELECT " +
"Guid ," +
"ProductNumber ," +
"ProductName ," +
"ProductStyle ," +
"ProductOrigin ," +
"PackUnit ," +
"ReferencePrice ," +
当Region = NUll时候要求ReferencePrice 列的值都为* 该怎么修改?
...全文
74 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
guoruixiaoni 2010-12-08
  • 打赏
  • 举报
回复
高手怎么还不进来 讲讲啊
gq198718 2010-12-08
  • 打赏
  • 举报
回复
非常感谢! 我再去试试
ycproc 2010-12-08
  • 打赏
  • 举报
回复
存储过程 判断 好些 免得 前台输入了引起的 怪问题
ycproc 2010-12-08
  • 打赏
  • 举报
回复
存储过程 判断 好些 免得 前台输入了引起的 怪问题
昵称被占用了 2010-12-08
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 gq198718 的回复:]
SearchProduct(string Region,string ProductName, string Manufacturer)
是Region参数
[/Quote]
...

string strSql = string.Empty;
strSql = "SELECT " +
"Guid ," +
"ProductNumber ," +
"ProductName ," +
"ProductStyle ," +
"ProductOrigin ," +
"PackUnit ,"
if Region = string.Empty
strSql = strSql +
"ReferencePrice ='*',"
else
strSql = strSql +
"ReferencePrice ,"

strSql = strSql + ...

gq198718 2010-12-08
  • 打赏
  • 举报
回复
SearchProduct(string Region,string ProductName, string Manufacturer)
是Region参数
水族杰纶 2010-12-08
  • 打赏
  • 举报
回复
或者写存储过程吧
在存储过程中判断
gq198718 2010-12-08
  • 打赏
  • 举报
回复
没有效果哦
gq198718 2010-12-08
  • 打赏
  • 举报
回复
我试试,谢谢回答
昵称被占用了 2010-12-08
  • 打赏
  • 举报
回复
"ReferencePrice ," +
------>

"ReferencePrice = case when Region is null then '*' else ReferencePrice end ," +

22,209

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧