当 sql 命令中的条件为阿拉伯语时,sqldatareader 出现其他问题
当 sql 命令中的条件是阿拉伯语时,sqldatareader 会出现问题:
select user_name from users where typ=N 'arabic text'
尽管存在具有此类型的用户名,但它不会检索任何数据
那么你能帮我吗? 谢谢^_^
There is a problem with sqldatareader when the condtion in sql command is arabic like this:
select user_name from users where typ=N 'arabic text'
This does not retrieve any data although there is a user name which has this type
so can you help me please ?
thank ^_^
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经重写了您的代码以使用查询参数。您希望避免像这样将字符串直接放入查询中(无论如何,类型很可能应该被标准化)。主函数可能应该将客户端列表返回到表示层,然后表示层将负责显示客户端,但我没有走那么远。
由于您的查询是在 Management Studio 中运行的,因此您的数据库排序规则设置应该没问题。
I've rewritten your code to use a query parameter. You want to avoid putting strings directly into your queries like that (the type should most likely be normalized anyway). The main function should probably return a list of clients to your presentation layer, which would then be responsible for displaying the clients, but I didn't go that far.
Since your query worked from within Management Studio, your database collation settings should be okay.