求高手帮看一段代码
[DBNETLIB][ConnectionOpen (Connect()).]SQL Server 不存在或拒绝访问。 数据库名没错,求高手指点using System;
using System.Collections;
using System.Collections.Specialized;
using System.Configuration;
using System.Data;
using System.Data.OleDb;
using System.Drawing;
using System.Reflection;
using System.
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.Caching;
using System.Web.SessionState;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
/// <summary>
///conn 的摘要说明
/// </summary>
public class conn
{
private static string connection = "Provider=SQLOLEDB;Data Source=DFSDFG-LP0WH4KC\\SQLEXPRESS;uid=sa;pwd=181818;Database=ExamOnline;";
public OleDbConnection SqlConn = new OleDbConnection(connection);
public conn()
{
//
//TODO: 在此处添加构造函数逻辑
//
}
public void DBopen()
{
if (SqlConn.State == ConnectionState.Closed)
{
SqlConn.Open(); 此块代码出现异常
}
}
public void DBclose()
{
if (SqlConn.State == ConnectionState.Open)
{
SqlConn.Close();
}
}
[ 本帖最后由 zhang5022 于 2010-3-17 23:22 编辑 ]