PDA

View Full Version : خطا network name is no longer available



mahlake
دوشنبه 21 تیر 1395, 09:46 صبح
سلام دوستان میخواستم بدونم که خطای زیر معنیش چی هست؟
و این که علتش چیه؟
و نهایتن این که چطور میشه حلش کرد؟
*ـ* من خیلی گشتم اما این خطا در فروم اصلا نبود *ـ*

A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The specified network name is no longer available.)

کدی که من نوشتم و این خطا رو میده:



string connectString1 = "Data Source=000.000.000.000;Initial Catalog=databasename;User ID=userlogin;Password=passwordlogin;Persist Security Info=True";

for (int i=0;dataGridView1.Rows.Count-1>i;i++)
{


string commandText1 = "select cid from jadval where cid=N'" + dataGridView1.Rows[i].Cells[0].Value.ToString() + "'";
try
{
using (TransactionScope scope = new TransactionScope())
{
using (SqlConnection connection1 = new SqlConnection(connectString1))
{
if (connection1.State == ConnectionState.Closed)
{
connection1.Open();
}
DataTable dt = new DataTable();
SqlDataAdapter aadb = new SqlDataAdapter("select cid from jadval where plk=N'" + dataGridView1.Rows[i].Cells[4].Value.ToString() + "'", connection1);
aadb.Fill(dt);
if (dt.Rows.Count == 0)
{
string commandText2 = "INSERT INTO jadval (tvd,shm,shsh,plk,clr,cpn,mob,shb,shs,dtv,pnb,odt, dcb,cid,jbja,gng,rid,gpn,dcs,dgd,emza,uid,ddpc,drp c,num,trkhd,trkht) VALUES(N'" + dataGridView1.Rows[i].Cells[13].Value.ToString() + "',N'" + dataGridView1.Rows[i].Cells[2].Value.ToString() + "',N'" + dataGridView1.Rows[i].Cells[3].Value.ToString() + "',N'" + dataGridView1.Rows[i].Cells[4].Value.ToString() + "',N'" + dataGridView1.Rows[i].Cells[5].Value.ToString() + "',N'" + dataGridView1.Rows[i].Cells[6].Value.ToString() + "',N'" + dataGridView1.Rows[i].Cells[7].Value.ToString() + "',N'" + dataGridView1.Rows[i].Cells[8].Value.ToString() + "',N'" + dataGridView1.Rows[i].Cells[9].Value.ToString() + "',N'" + dataGridView1.Rows[i].Cells[10].Value.ToString() + "',N' ',N' ',N' ',N'0',N'0',N'" + dataGridView1.Rows[i].Cells[16].Value.ToString() + "',N'0',N'" + dataGridView1.Rows[i].Cells[18].Value.ToString() + "',N' ',N' ',N'" + dataGridView1.Rows[i].Cells[21].Value.ToString() + "',N'0',N' ',N' ',N'0',N' ',N' ')";
if (connection1.State == ConnectionState.Closed)
{
connection1.Open();
}


SqlCommand command2 = new SqlCommand(commandText2, connection1);
command2.ExecuteNonQuery();

}
}
scope.Complete();
}
}
catch (SqlException ex)
{
MessageBox.Show("SqlException Message:" + ex.Message + "", "خطا");
}
}

mahlake
دوشنبه 21 تیر 1395, 09:58 صبح
راستی یادم رفت بگم که این اتفاق هر ۱۰۰۰ تا رکورد یک بار اتفاق میافته...
البته یک مشکل جدید هم به وجود اومده برنامه هر از گاهی هنگ میکنه... موقع سرچ
اما تا ۱ ماه پیش اینطوری نبود...