PDA

View Full Version : مشکل ارتباط با ، بانک سرور از لوکال !



merlin_vista
جمعه 14 دی 1386, 22:41 عصر
آقا من میخواهم از داخل کدها به بانک سرور وصل بشم و اطلاعات را از بانک بگیرم و در داخل آن اطلاعات را درج کنم !! برای این کار از کانکشن و کدهای زیر استفاده کردم ::خجالت:

protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=www.esfahannnet.com;Initial Catalog=asannet;User ID=;Password=");
SqlDataAdapter dat = new SqlDataAdapter("Select * from LinkDostan", con);
DataSet dst = new DataSet();
dat.Fill(dst, "tb");
this.GridView1.DataSource = dst.Tables["tb"].DefaultView;
this.GridView1.DataBind();
}ولی این خطا را داد :

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)میشه بگید مال چیه و اصلاً برای این کار سرور باید چیزی را پشتیبانی بکنه یا نه ؟؟ :متفکر:

miladr
جمعه 14 دی 1386, 23:03 عصر
جای Data Source از IP استفاده کن این شکل استفاده غلطه. تحقیق کن ببین از Port باید استفاده کنی یا نه.اگه همه اینها به نتیجه نرسید باید از هاست سوال کنی که آیا به Remote connection اجازه میده یا نه.اگه نده احتمال داره بگن IP سیستم رو بدی تا ثبت بشه.

maxpayn2
شنبه 15 دی 1386, 07:58 صبح
من هم این مشکل رو روی یکی از هاست ها داشتم با راهنمایی مسئول هاست اینجوری نوشتم :




cnn.ConnectionString = "Data Source=IP;Persist Security Info=True;User ID=user;Password=pass;Initial Catalog=database name";




امتحان کن شاید جواب بده