PDA

View Full Version : سوال: خطای The network path was not found در هاست



پیام حیاتی
شنبه 22 شهریور 1393, 12:59 عصر
سلام
یک فرم ایجاد کردم در این دامین (http://payam-hayati.com/) ،فرم رو در لوکال تست کردم بدون مشکل به بانک متصل میشه اما در هاست با این خطا مواجه میشم :

Server Error in '/' Application.

The network path was not found

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.ComponentModel.Win32Exception: The network path was not found


الآن برای اتصال بانک در لوکال کوئری نوشته شده به این شکل هست :

sqlserver sqls = new sqlserver(".", "Contact");


در هاست به این شکل تغییر دادم اما مثل اینکه درست نیست:

sqlserver sqls = new sqlserver("http://payam-hayati.com", "Contact");
IP هم تست کردم باز همین خطا بود.

این کل کد هست که در لوکال استفاده می کنم :

sqlserver sqls = new sqlserver(".", "Contact");
sqls.update("insert into Table_1 values('" + fullname.Text + "','" + email.Text + "','" + description.Text + "')");
Response.Write("ارسال با موفقیت انجام شد");
fullname.Text = "";
email.Text = "";
description.Text = "";


این هم کلاسی که در پوشه App_Code برای کانکشن ها نوشتم :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;




namespace sql
{
public class sqlserver
{
SqlConnection con;
SqlDataAdapter da ;
SqlCommand sc;



public sqlserver(string server,string dbname)
{
con = new SqlConnection("Data Source=" + server + ";Initial Catalog=" + dbname + ";Integrated Security=True");
da = new SqlDataAdapter();
sc = new SqlCommand();
da.SelectCommand = new SqlCommand();
da.SelectCommand.Connection = con;
sc.Connection = con;
}
~sqlserver()
{
con.Close();
}

public DataTable select(string str_q)
{
DataTable temp = new DataTable();
da.SelectCommand.CommandText = str_q;
con.Open();
da.Fill(temp);
con.Close();
return temp;
}
public int update(string str_q)
{
int result;
sc.CommandText = str_q;
con.Open();
result = sc.ExecuteNonQuery();
con.Close();
return result;
}

public int update(string str_q,object image)
{
int result;
sc.CommandText = str_q.Replace("**","@picture");
sc.Parameters.Add("@picture",image);
con.Open();
result=sc.ExecuteNonQuery();
con.Close();
return result;
}



}

}

پیام حیاتی
شنبه 22 شهریور 1393, 17:22 عصر
اساتید؟!:گریه: