我建立了一个数据库的连接类,并建立了连接.我在另外页面导如命名空间(using system.data.sqlclient),但是没连上数据库.是什么问题啊.我看的是北大青鸟的视频教程,我是仿照上面的代码做的.

解决方案 »

  1.   

    代码帖出来看看
    虽然我学艺不精,但是ADO。NET写过几百遍,熟的很,应该没有问题
      

  2.   

    既然你在一个类里写了这个连接方法了...其它页面干吗还要引用using system.data.sqlclient
    直接实例化那个类算了..或者继承..
      

  3.   

    SQL Server 外围应用配置器
    --〉服务和连接的外围应用配置器
    下修改 远程连接 配置
      

  4.   

    给你个例子:
    <connectionStrings>
            <add name="总公司工时定额管理.Properties.Settings.BusInfoSysConnectionString"
                connectionString="Data Source=ecstation;Initial Catalog=BusInfoSys;Persist Security Info=True;User ID=sa;Password=666666"
                providerName="System.Data.SqlClient" />
        </connectionStrings>
    ecstation:计算机名
    看看 sql server 的tcp/ip协议打开每