当前位置:编程学习 > C#/ASP.NET >>

在上传网站到空间的时候遇到的棘手问题。求帮助啊.!

asp.net 期末考试的时候做了一个作品  个人觉得还可以  在家里用vs运行是可以的 但是上传到空间去就不行了  
话说要支持.net的空间真难找啊 . 
http://kukuga123.71147.ftpdo.com 
这就是地址了
数据库连接全是相对路径 
 SqlConnection conn = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=" + Server.MapPath("~\\App_Data\\kendiewanh_Data.MDF") + ";Integrated Security=True;User Instance=True");
应该没有问题才对啊 
具体错误 
Server Error in '/' Application.

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Inte易做图ces, error: 26 - Error Locating Server/Instance Specified)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Inte易做图ces, error: 26 - Error Locating Server/Instance Specified)

Source Error: 


Line 40:         SqlDataAdapter da = new SqlDataAdapter(cmd);
Line 41:         DataSet ds = new DataSet();
Line 42:         da.Fill(ds, "book_title");
Line 43:         datalist1.DataSource = ds.Tables[0].DefaultView;
Line 44:         datalist1.DataBind();

Source File: d:\webroot\kukuga123\web\index.aspx.cs    Line: 42 
求高手帮助  --------------------编程问答-------------------- 你问问你的空间商支持SQL Server数据库吗?
--------------------编程问答-------------------- SqlConnection conn = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=" + Server.MapPath("~\\App_Data\\kendiewanh_Data.MDF") + ";Integrated Security=True;User Instance=True");


数据库链接可以这样吗,明显没有找到数据库引起的 --------------------编程问答--------------------
引用 2 楼 liuchaolin 的回复:
SqlConnection conn = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=" + Server.MapPath("~\\App_Data\\kendiewanh_Data.MDF") + ";Integrated Security=True;User Instance=True");


数据库链接……

受教了   请问 应该怎么写呢.
这是在学校老师叫我们这么写的. --------------------编程问答-------------------- server=.;uid=用户名;pwd=密码;database=数据库;


以上信息你可以在网络服务商那里得到 --------------------编程问答--------------------
引用 1 楼 net_lover 的回复:
你问问你的空间商支持SQL Server数据库吗?

我的空间是在白手起家网 开的  看了之后好像确实不支持sql数据库  先吧数据库换成ACCESS 看看吧. --------------------编程问答-------------------- 连接数据库出错了,还有就是像1楼那样问下你的空间商,支持sql server 数据库么,支持的是什么版本,连接数据库的语句和本地连接一个样儿,你要知道你访问你数据库的IP,用户名,密码,这样就可以了
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,