好像没问题啊,可能你的.net framework坏了,重新装一下

解决方案 »

  1.   

    应该是这个问题:.net framework坏了
    看看这句话就知道了Compiler Error Message: CS0234: The type or namespace name 'OleDb' does not exist in the class or namespace 'System.Data'
      

  2.   

    是啊,我认为程序也没问题,但我刚装的.NET Framework啊,莫非.NET Framework版本太低,不包含System.Data.OleDb名字空间?
      

  3.   

    借个光问问:asp.net连接SQL的问题
    我用asp.net做了一个系统登陆的页面.后台数据库采用的是SQL SERVER 2000
    欲用SQL Managed Provider进行连接,代码如下:
    <%@ import namespace="System.Data" %><%@ import namespace="System.Data.SQLClient" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <title>欢迎使用万维软件-HR </title>
    <META http-equiv="Content-Type" content="text/html; charset=gb2312">
    <script language="VB" runat="server">  Public Sub Page_Load(sender As Object,e As EventArgs)
        if not Page.IsPostBack then
          '网页组件初始设置
          lblMsg.text = ""
          UserName.text = ""
          Password.text = ""
        end if  End Sub  Sub btOK_Click(sender As Object,e As EventArgs)
        Dim strConn,strSQL,getpsw As String  
           
         strSQL = "select UserID,UserName,Password,Preview from userinfo"    strSQL = strSQL & " where e.UserName='" & UserName.text & "' "
        
       dim myConn as SQLConnection =New SQLConnection("server=localhost;Integrated Security=SSPI;Intial Catalog=HR")
        dim myCommand as SQLCommand  = New SQLCommand(strSQL,myConn)
        myConn.open()       '取得OleDbDataReader对象
        dim dr as ExcuteReader = myCommand.Reader()    if dr.read() then
         session("UserName") = dr.item(1)
        getpsw=dr.item(2)
         if(Password.text<>getpsw)
            lblMsg.text="您输入的密码不正确!请重新输入!"
           UserName.text=dr.item(0)
           Password.text=""
          
         else 
         lblMsg.text="登陆成功"
         Page.Response.redirect("aaa.aspx")
        'if dr.isdbnull(1) then
          ' session("UserName") = ""
       ' else   
         '  session("UserName") = dr.item(1) 
       end if
                'Page.Response.redirect("MainFunction.aspx")   'MainFunction.aspx为主功能页面
      else
        
          session("UserName") = ""
      session("Password") = ""
       lblMsg.text="用户号或密码输入错误!!请重新输入!!"
         UserName.text = ""
          Password.text = "" 
        end if    myConn.Close() 
      End sub  Sub btReset_Click(sender As Object,e As EventArgs)
        UserName.text = ""
        Password.text = ""
        lblMsg.text=""
      End sub </script>
    </HEAD>
    <body bgColor="white">
    <p align="center"><br>
    <br>
    <p align="center"><b><font face="宋体" color="blue" size="6">企业人事管理系统</font></b></p>
    <form id="Form1" runat="server">
    <table cellSpacing="0" borderColorDark="#ffffff" cellPadding="3" width="400" align="center"
    borderColorLight="#003333" border="1">
    <tr>
    <td vAlign="top" bgColor="#ff6699" colSpan="2" height="25">
    <p align="center"><font color="#ffff66">登录信息</font></p>
    </td>
    </tr>
    <tr>
    <td vAlign="top" align="right" height="25">用 户 号
    </td>
    <td vAlign="top" height="25"><asp:textbox id="UserName" runat="server"></asp:textbox></td>
    </tr>
    <tr>
    <td vAlign="top" align="right" height="25">密 码
    </td>
    <td vAlign="top" height="25"><asp:textbox id="Password" runat="server" textmode="password"></asp:textbox></td>
    </tr>
    <tr>
    <td align="center" colSpan="2" height="25"><asp:button id="btOK" onclick="btOK_Click" runat="server" Text="登录"></asp:button><asp:button id="btReset" onclick="btReset_Click" runat="server" Text="重置"></asp:button></td>
    </tr>
    </table>
    <table cellSpacing="0" cellPadding="3" width="400" align="center" border="0">
    <tr>
    <td><asp:label id="lblMsg" runat="server"></asp:label></td>
    </tr>
    </table>
    </form>
    </body>
    </HTM>
    出现以下错误信息:
    System.Data.SqlClient.SqlException: SQL Server 不存在或访问被拒绝。源错误: 
    行 29:    dim myConn as SQLConnection =New SQLConnection("server=local;Integrated Security=SSPI;Data Source=friend\HR")
    行 30:     dim myCommand as SQLCommand  = New SQLCommand(strSQL,myConn)
    行 31:     myConn.open()
    行 32: 
    行 33:    
     
    请各位帮忙如何改正
      

  4.   

    System.Data.SqlClient.SqlException: SQL Server 不存在或访问被拒绝。就是sqlserver 名字写错了或者用户名和密码错误
      

  5.   

    我运行上面的代码怎出现这样的问题?
    Server Error in '/samples' Application.
    --------------------------------------------------------------------------------The resource cannot be found. 
    Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Requested Url: /samples/鏂板缓 鏂囨湰鏂囨。 (3).aspx
    --------------------------------------------------------------------------------
    Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573 
    各位高手这是为什么呀?怎么解决呀?我是菜鸟,借贵宝地一用!谢了!
      

  6.   

    应该是string uid=Request.QueryString["username"];
    你试试看行不行啊?