جستجو در بانک سوالات
در این قسمت می توانید بخشی از متن سوال را وارد نموده و به دنبال سوال مورد نظر خود بگردید:

بخشی از متن سوال:

ارور در برنامه نویسی سی شارپ

سلام
من در زبان سی شارپ کدی برای اتصال به دیتابیس Sql نوشتم ولی با ارور زیر روبرو شدم:
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll

Additional information: 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
لطفا اگه کسی میدونه کمک کنه
ممنونم



0
امتیاز

جوابی برای این سوال در دست نیست!




جواب تو چیه؟
userImage
کاربر میهمان


20000 امتیاز هدیه بهترین جواب


17500 امتیاز هدیه بهترین جواب










در قسمت 9 ویدیو یاد داده شد که چگونه دو تا ایتم به سبد خرید اضافه کنیم با این کد ها

  protected void AddToShoppingCart_Click(object sender, EventArgs e)
 
{

Button btn = (Button)sender;
if (Session["shoppingCart"]!= null)
{
Session["shoppingCart"] += "," + btn.ToolTip;
}
else
{
Session.Add("shoppingCart", btn.ToolTip);

}

// Response.Redirect("shoppingCart.aspx");
}


و این کد
protected void Page_Load(object sender, EventArgs e) { if (Session["status"] != null && Session["status"].ToString() == "Login") { //successful login sql_addedProds.SelectCommand = "SELECT * FROM [Products] WHERE ([id] in (" + Session["shoppingCart"].ToString() + "))"; } else { Response.Redirect("login.aspx"); } }
ولی وقتی دو ایتم یه سبد اضافه می کنم این ارور را می دهد
Server Error in '/' Application.
Input string was not in a correct format.
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.FormatException: Input string was not in a correct format.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[FormatException: Input string was not in a correct format.]
System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +14286670
System.Number.ParseInt32(String s, Num
{
if (Session["status"] != null &&
Session["status"].ToString() == "Login")
{


//successful login
sql_addedProds.SelectCommand = "SELECT * FROM [Products] WHERE ([id] in ("
+ Session["shoppingCart"].ToString() + "))";


}
else
{
Response.Redirect("login.aspx");
}










پرسش سوال جدید :: تبلیغات در سوال و جواب :: گروه های سوال و جوابی

تمامی حقوق مادی و معنوی، متعلق به وب سایت سوال جواب (soja.ai) و تیم مدیریتی آن می باشد.

طراحی و اجرا : گروه مشاوران فناوری اطلاعات

پاسخ های موجود در سایت توسط کاربران سایت ثبت می شود،
سایت سوال و جواب هیچ مسئولیتی در قبال صحت و محتوی پاسخ ها ندارد، هرچند تا حد امکان نظارت بر محتوی آنها صورت می گیرد.