my.sky1314 - 2008-6-7 10:36:00
我用的是sql2005,服务器名称是:WWW-A5DCE4D67B3\SQLEXPRESS,身份验证是:windows身份验证,我创建的数据库是bbs,在.net2005中连接数据库提示这个错误:
无法打开登录 'bbs' 中请求的数据库。登录失败。
用户 'WWW-A5DCE4D67B3\Administrator' 登录失败。
连接数据库代码:
string c;
SqlConnection myConnection = new SqlConnection(connstr);
string checkstr="select count(*)from bbs_register where(username='"+username.Text+"' and pwd='"+pwd.Text+"')";
SqlCommand myCommand = new SqlCommand(checkstr, myConnection);
myConnection.Open();
int flag = (int)myCommand.ExecuteScalar();
myConnection.Close();
这是数据库问题还是代码问题
my.sky1314 - 2008-6-10 13:23:00
:-| :-|
weblogical - 2008-6-17 16:34:00
checkstr ???
要改为windows和sql 两种身份模式