我的SQL查询命名样式是错误的吗? [英] Is my SQL query naming style wrong?

查看:69
本文介绍了我的SQL查询命名样式是错误的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立了一个asp.net网站,有时会说未指定错误,有时会发生,并非总是如此:

I build a asp.net website, sometimes it says "Unspecified error", it happens sometimes, not always:

 string query = "SELECT TOP 1 * FROM AboutUs";
 var reade = AccessHelper.GetReader(query);      // Unspecified error occurs here
 reader.Read();
 // ..read things

DataSet data = AccessHelper.GetDataSet(narstr);
Repeater1.DataSource = data;



有人说我使用保留的关键字,如查询和读者,似乎如果我将变量名更改为其他内容,网站将好好的。但我不认为这是问题,

我没有使用查询,读者处于SQL状态。

我认为问题是我忘了使用某处的Close()方法。



我想知道上面的代码是否有命名问题。


some people say that I use the reserved keywords like query, and reader, It seems that if I change the variable name to something else, the website will wrok properly. But I don't think this is the problem,
I didn't use the query, reader in the SQL statemtent.
I think the problem is that I forget use Close() method somewhere.

I want to know the code above whether has naming problem.

推荐答案

我没有得到你的完整代码所以不确定为什么会出现这个错误,但这肯定是,这不是命名风格相关的问题。使用try catch块来获取确切的错误消息。
I am not getting your full code so not sure why this error coming but this is for sure that, this is not a naming style related problem. Use a try catch block to get the exact error message.


这篇关于我的SQL查询命名样式是错误的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆