Click here to Skip to main content
15,899,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi To All. i have the following Problem . i had developed the web application . it is working when single user working it is good.

When More Than One User Working on The Same Application . it will gave the message like 'Sql Data Reader Error'. For that i had wrote the Option 'MultipleActiveResultSets=True' in Connection String of Web Config File. it is also not working.


----> So I Want To Execute The Request[i.e Requests are got fom the diffeent users] One by One Without Interruption. Please Give The Code As well as i Wrote the Following Code for that.



public void CreateConnection()
{
if (_Connection == null)
{
string Connection = ConnectionStrings.ConnectionString;
_Connection = new SqlConnection(Connection);
//_Connection.Open();
}
}

public void OpenConnection()
{
CreateConnection();
if(_Connection.State != ConnectionState.Open)
_Connection.Open();
}

public void CloseConnection()
{
if(_Connection.State == ConnectionState.Open)
_Connection.Close();
}

public DataTable GetTableByQuery(string Qry)
{
CreateConnection();
DataTable _table = new DataTable();
SqlDataAdapter _adapter = new SqlDataAdapter(Qry,_Connection);
using (_adapter)
{
//try
{
_adapter.Fill(_table);
int count = _table.Rows.Count;
}
//catch (System.Exception e)
//{
// string msg = e.Message;
//}
}
return _table;
}
Posted

1 solution

 
Share this answer
 
Comments
Nanaji Annamreddi 8-Apr-14 4:15am    
Well But This is Not Working. Other Wise You Have To Give Solution For Execute the Requests One By One .

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900