2.0连接sqlserver2000的怪问题
我用的是vs2005+sqlserver2000.在vs2003下没有任何问题,为啥在vs2005编译时提示错误??
protected void Button1_Click(object sender, EventArgs e)
{
if (Page.IsValid)
// if(!Page.IsPostBack)
{
String strConnection = ConfigurationSettings.AppSettings[ "ConnectionString "];//公用
cn = new SqlConnection(strConnection);
SqlCommand cm = new SqlCommand( "classdata1 ", cn);
cm.CommandType = CommandType.StoredProcedure;
DateTime dt = DateTime.Now;
cm.Parameters.Add(new SqlParameter( "@usort ", SqlDbType.VarChar, 50));
cm.Parameters.Add(new SqlParameter( "@utypename ", SqlDbType.VarChar, 50));
cm.Parameters.Add(new SqlParameter( "@uwenti ", SqlDbType.VarChar, 50));
cm.Parameters.Add(new SqlParameter( "@uwentilist ", SqlDbType.VarChar, 50));
cm.Parameters.Add(new SqlParameter( "@ipaddress ", SqlDbType.VarChar, 50));
cm.Parameters[ "@usort "].Value = ddl1.SelectedItem.Text;
cm.Parameters[ "@utypename "].Value = ddl2.SelectedItem.Text;
cm.Parameters[ "@uwenti "].Value = dd3.SelectedItem.Value;
cm.Parameters[ "@uwentilist "].Value = t1.Text;
cm.Parameters[ "@ipaddress "].Value = Request.UserHostAddress;
cm.Connection.Open();
编译的时候,在点击提交时,出现这个错误,我的数据库是sqlserver2000.为什么提示:sqlerver2005??
在建立与服务器的连接时出错。在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败。 (provider: 命名管道提供程序, error: 40 - 无法打开到 SQL Server 的连接)
;
try
{
cm.ExecuteNonQuery();