asp.net连接SQLserver2005问题
string userpossword; SqlConnection conn = new SqlConnection("server=.\\SQL2005;uid=sa;pwd=sa;database=TongXunLuDB"); string strcon = "select userpassword from UserLoginInfo where username='admin'"; conn.Open(); SqlCommand cmd = new SqlCommand(strcon,conn); SqlDataReader dr = cmd.ExecuteReader() ; userpossword = dr["userpassword"].ToString(); return userpossword; 这是连接的函数,连接应该没又问题,就是datareader变量中没有值,在查询分析器中执行上面的SQL语句可以查出来结果,但是到这就没有结果,dr里面的字段没又问题,这到底为什么呢,这么简单的地方,,,
单步调试。。。引用 单步调试。。。 调了,不兴啊 试着这样写一下! SqlDataReader dr = cmd.ExecuteReader() ; if(dr.Read()) { userpossword = dr["userpassword"].ToString(); } return userpossword; 很不错啊。顶。。引用 试着这样写一下! SqlDataReader dr = cmd.ExecuteReader() ; if(dr.Read()) { userpossword = dr[
相关问答:
select top 12 * from Product where [id] not in (select top 12 [id] from Product) 这样可以分页,但是我在后面想加个条件 select top 12 * from Product where [id] not in (select top 12 [id] from Prod ......
哪位大哥有没有ASP.NET中利用Cookies实现用户自动登录的代码...谢谢了...越详细越好.... 什么意思?自动登录? mark 貌视是存储cookies 我也对cook比较迷糊 关注下 既然你知道用cookies自己动动大脑多好! ......
我主要想控制下word保存的地址,但是编译不过去,总觉得是缺了using。。。 谢谢 代码如下: using System; using System.IO; using System.Collections; using System.ComponentModel; using System.Data; u ......
dsQuyMst.Tables["QuyMst"].Rows[0]["SHDOCO"] = "1111";//这句报错(未将对象引用设置到对象的实例。) 这知道是什么原因? 高人指点~~~ using System; using System.Data; us ......
页面 Index.aspx 运行时 页面样子变了 把Index.aspx 生成的代码 复制到 index.html里面运行就没问题 不知道为什么 CSS路径都是相对的 路径用/css/your.css来表示 第一个/表示网站根目录。 路径可能有 ......