Showing error message
-
Hi, I am developing a simple web application in ASP.net. I would like to know in database connection if I face with error how I should show it. do I have to use java script? because unlike desktop application can't use message box.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
using System.Data.Sql;
using System.Configuration;namespace Test.DataAccessLayer
{
public class PersonDataAccess
{SqlConnection Conn = new SqlConnection(ConfigurationManager.ConnectionStrings\["HostelConnectionString"\].ConnectionString); public void insert() { try { Conn.Open(); } catch (Exception ex) {
????????????????????????????????????????????????????????????????????????????
}
}
}
} -
Hi, I am developing a simple web application in ASP.net. I would like to know in database connection if I face with error how I should show it. do I have to use java script? because unlike desktop application can't use message box.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
using System.Data.Sql;
using System.Configuration;namespace Test.DataAccessLayer
{
public class PersonDataAccess
{SqlConnection Conn = new SqlConnection(ConfigurationManager.ConnectionStrings\["HostelConnectionString"\].ConnectionString); public void insert() { try { Conn.Open(); } catch (Exception ex) {
????????????????????????????????????????????????????????????????????????????
}
}
}
} -
Hi, I am developing a simple web application in ASP.net. I would like to know in database connection if I face with error how I should show it. do I have to use java script? because unlike desktop application can't use message box.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
using System.Data.Sql;
using System.Configuration;namespace Test.DataAccessLayer
{
public class PersonDataAccess
{SqlConnection Conn = new SqlConnection(ConfigurationManager.ConnectionStrings\["HostelConnectionString"\].ConnectionString); public void insert() { try { Conn.Open(); } catch (Exception ex) {
????????????????????????????????????????????????????????????????????????????
}
}
}
}you can show your message, by using Java script alert Message as
Response.Write("<script>alert('Your Message')</script>");
or you can also use custom error concept to show your message while a error generate follow link Custom Errors in ASP.NET[^]
-
Hi, I am developing a simple web application in ASP.net. I would like to know in database connection if I face with error how I should show it. do I have to use java script? because unlike desktop application can't use message box.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
using System.Data.Sql;
using System.Configuration;namespace Test.DataAccessLayer
{
public class PersonDataAccess
{SqlConnection Conn = new SqlConnection(ConfigurationManager.ConnectionStrings\["HostelConnectionString"\].ConnectionString); public void insert() { try { Conn.Open(); } catch (Exception ex) {
????????????????????????????????????????????????????????????????????????????
}
}
}
}It is not a good practice, to show exception errors in javascript alert. Better , if you find any exception , show in that page or redirect to some other error page
Cheers!! Brij Visit my Blog: http://brijbhushan.net
Check my latest Article :ViewState - Various ways to reduce performance overhead -
It is not a good practice, to show exception errors in javascript alert. Better , if you find any exception , show in that page or redirect to some other error page
Cheers!! Brij Visit my Blog: http://brijbhushan.net
Check my latest Article :ViewState - Various ways to reduce performance overheadBrij wrote:
Better , if you find any exception , show in that page or redirect to some other error page
Ya i knew it, that's why i have already describe or refer a link about custom error which works as you say.:suss:
-
Brij wrote:
Better , if you find any exception , show in that page or redirect to some other error page
Ya i knew it, that's why i have already describe or refer a link about custom error which works as you say.:suss:
RaviRanjankr wrote:
Ya i knew it, that's why i have already describe or refer a link about custom error which works as you say
Obiously, you must be knowing. I just suggested , not to use JS alert.
Cheers!! Brij Visit my Blog: http://brijbhushan.net
Check my latest Article :ViewState - Various ways to reduce performance overhead -
RaviRanjankr wrote:
Ya i knew it, that's why i have already describe or refer a link about custom error which works as you say
Obiously, you must be knowing. I just suggested , not to use JS alert.
Cheers!! Brij Visit my Blog: http://brijbhushan.net
Check my latest Article :ViewState - Various ways to reduce performance overheadBrij wrote:
Obiously, you must be knowing. I just suggested , not to use JS alert.
whatever, thanks for your guidance or suggestion. ;) ;)