Hello Guys,
I have Developed one website in Asp.Net 4.0 And Sql Server 2012 And I used 3-tier Data Access method but sometimes many requests are occur then data lost from Sql Server Db so why this happen?
If you have solution then reply me.
Below is my sample code
in DataClass.cs filldata method :
public static SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["constr"].ConnectionString);
public static DataTable Filladptor(SqlCommand cmd)
{
DataTable dt = new DataTable();
cmd.Connection = cn;
SqlDataAdapter adp = new SqlDataAdapter(cmd);
try
{
//cmd = new SqlCommand();
if (cn.State == ConnectionState.Closed)
{
cn.Open();
}
adp.Fill(dt);
}
catch (Exception ex)
{
errmsg = ex.Message;
}
finally
{
cmd.Dispose();
if (cn.State == ConnectionState.Open)
{
cn.Close();
}
}
return dt;
}
IN Webconfig Connectionstring:
Thanks..
PnklPosted Dec 14, 2015, 12:13 AM
Hemant JoshiPosted Dec 10, 2015, 4:02 AM
PnklPosted Dec 10, 2015, 2:10 AM
Hemant JoshiPosted Dec 9, 2015, 6:11 AM