hoang79vn
June 4th, 2003, 12:41 AM
Hi all, my WEBSERVICE (written in C#) access MSDE db as follow:
[WebMethod]
public void TestDB(string strUserName)
{
string mySelectQuery = "SELECT * from table1 where name ='"+strUserName +"'";
string strCon = "Provider=SQLOLEDB;Password=xxx;User ID=sa;Initial Catalog=MyDB;Data Source=(local)";
OleDbConnection myConnection = new OleDbConnection(strCon);
OleDbCommand myCommand = new OleDbCommand(mySelectQuery,myConnection);
myConnection.Open();
//PROBLEM HERE!!!!
OleDbDataReader myReader = myCommand.ExecuteReader();
//DO NOTHING.
// always call Close when done reading.
myReader.Close();
//PROBLEM HERE!!!!
// Close the connection when done with it.
myConnection.Close();
}
Pls pay attention on the code block: //PROBLEM HERE!!!
without this block every thing is ok, but with this block, it seems that aspnet_wp.exe occupies memory increasingly & infinitively.
Thanks alot for any comment would be given.
[WebMethod]
public void TestDB(string strUserName)
{
string mySelectQuery = "SELECT * from table1 where name ='"+strUserName +"'";
string strCon = "Provider=SQLOLEDB;Password=xxx;User ID=sa;Initial Catalog=MyDB;Data Source=(local)";
OleDbConnection myConnection = new OleDbConnection(strCon);
OleDbCommand myCommand = new OleDbCommand(mySelectQuery,myConnection);
myConnection.Open();
//PROBLEM HERE!!!!
OleDbDataReader myReader = myCommand.ExecuteReader();
//DO NOTHING.
// always call Close when done reading.
myReader.Close();
//PROBLEM HERE!!!!
// Close the connection when done with it.
myConnection.Close();
}
Pls pay attention on the code block: //PROBLEM HERE!!!
without this block every thing is ok, but with this block, it seems that aspnet_wp.exe occupies memory increasingly & infinitively.
Thanks alot for any comment would be given.