大家看:http://comments.yesky.com/l/6704367/311124/0,0/0.shtml我不会调试

解决方案 »

  1.   

    你新建一个asp.net项目,添加一个页面叫test.aspx,然后把
    using System.Data.SqlClient;//引用命名空间。
    这1句复制到test.aspx.cs(在test.aspx页面点鼠标右键,‘查看代码’)文件顶部;
    把下面的复制到Page_Load函数大括号里面
    try 

    SqlConnection conn=new SqlConnection();
    conn.ConnectionString="Server=(local);Database=Northwind;Uid=sa;Pwd=;"; 
    conn.Open(); 

    catch(Exception ex) 

    Response.Write(ex.Message); 
    } Response.Write("连接数据库成功!"); 
    ---------------
    上面的例子要求本地有个sqlserver的数据库,且数据库sa帐号的密码为空,要求安装了Northwind示例数据库。
    =====================================
    欢迎进入.net的阵营