oleDbCommand1.ExecuteScalar() 转为int的问题!!!
八月 23rd, 2007 by
admin
热门软件下载:
我用c#制作了一个 web项目,后台数据库使用的是oracle,当我制作了一个登陆界面,代码如下:
string sc="select count(*) from users where(uno= "+textbox1.text +") and (upassword = "+textbox2.text +") and (id= "+dropdownlist1.selecteditem.text+")";
int i;
oledbconnection1.open();
oledbcommand1.commandtext=sc;
i=(int)oledbcommand1.executescalar();
if(i!=0)
{
if(dropdownlist1.selecteditem.text=="学生")
{
response.redirect("welcome.aspx");
}
}
调试时,系统报错,说oledbcommand1.executescalar()无法显式转为int 型,但使用sql server数据库时sqlcommand1.executescalar却可以,请问哪位大虾知道这是怎么一回事?怎样才能将oledbcommand1.executescalar()转为int型???
推荐阅读
Posted in IT |