DataSource Controls :: Connection Leak In IDataReader?

May 26, 2010

I heard that using "Using" Block avoids Connection Leaks in IDataReader. Is this correct??? If so how it will do that???

View 2 Replies


Similar Messages:

DataSource Controls :: Possible Memory Leak In DataTable.Select Method?

Jun 18, 2010

I have an application which was recently ported from Classic ASP to .NET 3.5. I'm pulling some data from a stored procedure and once retrieved, I'm doing using the Select method on the DataTable in a loop so I don't have to keep going back to the database.It appears that there's something wrong here as I can refresh the page repeatedly and see the memory usage increase by a few megabytes, up to the point where we get an error. If we recycle the app pool in IIS, it starts working again, for a little while.

Is there a memory leak in this method? I did some research on the subject and Microsoft said there was an issue like that in .NET 1.0 and 1.1, but I'm using a higher version.Or, is this something else, such as not managing resources correctly? Here's a snipped of my code:

[Code]....

Initially, this app was using XML instead of a datatable and using XPATH to query the data, but it was too slow. I thought using a dataset with DataTable selects was a better option, but now we found this issue. I was thinking since the loop executes several hundred times that getting all the data and filtering through it on the client was a better choice instead of calling several web methods to get the subsets of data.

View 5 Replies

DataSource Controls :: Connection Pooling And Check Connection State?

Apr 7, 2010

In my DAL i have more than 100 methods/Function, each and every method am opening the sqlconnection and closing the connection, this is taking too much of time to establish the connection at every time. So what i expect is one common class will create the SqlConnection that will check if the connection is Broken or Closed then create the connection again else return the connection, how to do this(Also i would like to apply ConnectionPooling).

View 7 Replies

Forms Data Controls :: IDataReader No Longer Can Be Bound To Repeater .NET 4.0?

Nov 19, 2010

I had a web application that was binding a IDataReader to a repeater control. I converted the project from 3.5(2.0) to 4.0 and then I received the error:

An invalid data source is being used for rptData. A valid data source must implement either IListSource or IEnumerable.

So, I used a datatable instead and the binding worked. So it seems that they have removed this functionality with .NET 4.0.

View 4 Replies

DataSource Controls :: Memory Leak - Server Will Crash - Log A Ton Of SQL Errors Stating That It Is "out Of Memory"

Jul 27, 2010

I have a memory leak somewhere that I cant find. Every few days my server will crash, and just before that I log a ton of SQL errors stating that it is "out of memory".

I cant find it anywhere, all of my connections are being disposed like so:

[Code]....
Then I call the connection from my pages like so:[Code]....

That is all pretty straight forward. The connection is disposed because it is implementing the USING clause. I am opening the connection in my connection manager class, and not where it is being utilized?Or, could the problem be in the below method I am using to populate a SqlDataReader:[Code]....

Now, at first it appears as though this could be the problem because the Connection isn't part of a USING clause, however doesn't the 'Data.CommandBehavior.CloseConnection' pretty much do the same thing. This makes sure that the connection is closed when the reader is closed, right? Here is how I call that above reader from my login page code behind:[Code]....

So the DataReader will get closed even without the .Close() because it is in the USING, and the connection should get closed because I specified it in the ExecuteReader paramters right?

View 8 Replies

DataSource Controls :: Variable Connection String Parameter In A DataSource Control

May 20, 2010

I have several web forms which use a GridView linked to a DataSource control which is defined at design time as follows:

<cc1:pgsqldatasource
id="dsStates"
runat="server"
connectionstring="<%&#36; ConnectionStrings:PgSqlConnection %>"
oldvaluesparameterformatstring="Original_{0}"
providername="<%&#36; ConnectionStrings:PgSqlConnection.ProviderName %>" >
</cc1:pgsqldatasource>

As you can see, the connectionstring parameter is defined to a specific connection string name and I need to be able to set such a parameter to a different value, for example, to a session variable content.

View 1 Replies

DataSource Controls :: How To Use Server.MapPath As Datasource While Creating Connection With OLEDB

Nov 15, 2010

i am trying to create connection using OLEDB connection in my app. but i am not able to create the connection as in datasource i want to use Server.mappath, but cudn't find the right method to use it. i am trying to make connection with Access database file. following is code i have tried:

string path = Server.MapPath("~/uploadaccess/Production.mdb");
string ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("~/uploadaccess/Production.mdb")&";";
and also
OleDbConnection myConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & path&";");
and tried this
OleDbConnection myConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("~/uploadaccess/Production.mdb"));

and this is the error i am getting:

Operator '&' cannot be applied to operands of type 'string' and 'string'

View 3 Replies

ADO.NET :: Re: Idatareader Data Access?

Feb 18, 2011

Did you check this c# - SQL Data Reader - handling Null column values - Stack Overflow

View 5 Replies

Forms Data Controls :: Checking IDataReader For Valid Data?

Aug 3, 2010

I'm populating a DataList using the IDataReader object and it works fine it the reader contains data. If the data is not present it displays nothing. I want to capture that situation and insert a verbiage such as "No data" or something like that. I've tried to test the datareader for various conditions such as Null, String.Empty, or plain " " but nothing worked. Is there a way to make this happen? Below is my code sample for your review.EJM.Note: It has to be done programatically as I'm building this for a web part.

[Code]....

View 2 Replies

Forms Data Controls :: Memory Leak - Gridview

Jan 13, 2011

I am using DevExpress Gridview basically, and hit out of memory exception whenever I keep refresh page that contains huge data. I reported to DevExpress team and they claimed it is ASP.NET gridview issue.

Therefore, I create a simple project, a girdview to sqlDataSource. Run the page and press F5 to refresh. I use ANTS profiler to check if any object instance is keep increasing but never been disposed. I found that, memory does happen in this simple project, as what DevExpress team claimed.[Code]....

View 4 Replies

DataSource Controls :: Ftp Connection Through Asp?

Feb 23, 2010

i have an asp page through which i want to access FTP server And retrieve data (only file properties )from there and get it in excel (or just display it on the browser)is there any way i can keep it simple and acess the data from the server ???

View 1 Replies

DataSource Controls :: Connection Errors

Mar 7, 2010

Connection Errors

[Code]....

View 5 Replies

DataSource Controls :: Best Practice For SQL Connection?

Mar 11, 2010

I was just wondering what would be the best practice for sql connection in asp.net, when using a loop

[Code]....

or...

[Code]....

View 2 Replies

DataSource Controls :: OLEDB Connection

May 27, 2010

The attached code, the oledb part, is giving me a blank web page saying it cant connect on my local dev server. I have another app with the same code, in fact I copied it and changed the db names. The one I copied from works fine.

[Code]....

View 5 Replies

DataSource Controls :: Passing Connection By Ref?

Mar 15, 2010

Issues with the below code. I feel something wrong here. Advisable to use or recode? below is my connection pooling class.

[Code]....

i create new connection and close the it by passing its reference as below in finally block.

[Code]....

View 7 Replies

DataSource Controls :: One Linq Query With Two Db Connection?

May 31, 2010

I want to use from two db connection in one linq query

My sample is:

int a=1;
if(a==1)
DataClasses1DataContext1 db = new DataClasses1DataContext1();
else
DataClasses1DataContext2 db = new DataClasses1DataContext2();
var q =
from c
in db.F_Groups
select c;

In this code a=1 so db connection is DataClasses1DataContext1

I want if a=2 then db connection = DataClasses1DataContext2

but this code is error.

db connections is completely same but in two deferent class a db connection is sql and another is oracle

View 4 Replies

DataSource Controls :: Could Not Establish A Connection To The Database

Apr 1, 2010

I'm having a problem, which I haven't had with other projects, in setting up membership. I have set up a aspnetdb database using the asp.net confirguration tool. The database is in the app data folder and I can set up users and roles etc from the web site administration tool. However, trying to log in within the application, using the login control I get "Login attempt was not successful".

I have noted the following :-

1. On the home page of the Web site administration tool the application:/ shows no application where as normally it would show the name of the application.

2. Clicking the AspNetSqlProvider test button, I get the error "could not establish a connection to the database"

3. Although various lines have been added to the web config file, no connection string has been created to the aspnetdb file in the app data folder.

4. If you right click on the aspnetdb file within the solution explorer, there is an option of "include in project". Selecting this doesn't however solve the problem.

View 2 Replies

DataSource Controls :: How To Programatically Set A Connection String

Sep 13, 2010

I am thinking of putting a drop down list to choose a couple of options. Depending on what is selected I want to then specify a specific connection string. I use the ConnectionString="<%$ ConnectionStrings:SomeConnectionString %>" format. How can I handle this in the .aspx page?

View 4 Replies

DataSource Controls :: SQLDataSource Connection String On The Fly?

Sep 12, 2010

I need to set the SQLDataSource connection string on the fly. Right now, this is what I have:

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
OnSelecting="SqlDataSource1_Selecting"
SelectCommand= (working select stmt here)</asp:SqlDataSource>

Then, I have this:

[code]....

View 4 Replies

DataSource Controls :: ReadOnly DB Connection Strings

Jan 14, 2010

This seems like a really silly question, but I've had a search around and I can't find anything about this. I've got a DB connection string that I'm creating in my web.config:-

[Code]....

and

[Code]....

but I need this connection to be read only. I've defined all my linq objects with only gets on their properties, and none of my (MVC) repository classes have .SubmitChanges() methods in them so I'm 99% sure the system can't update this DB, but I would also like to set my DB connection to be RO if at all possible. I realise that ideally this should be done at the SQL server end and the user should be made RO, but that (for various reasons, out of my control) can't be done, so I wanted to lock down my connection as the app mustn't write to the DB.

Is there a "readonly" parameter I can apply to the connection string so that it would throw an error or discard the data if any updates were attempted?

View 8 Replies

DataSource Controls :: Inner Join Using Two Different Connection Strings

Feb 11, 2010

Anyone know if it's possible to inner join tables using two different connection strings? I'm using vb.

View 3 Replies

DataSource Controls :: CLR Connection String From Web.config?

Jun 16, 2010

I am using CLR project in my website.I have used bulk insert in there.I am not able to use context connection in the procedure.Is there any way to get the connection string from web.configor from context connection.

View 5 Replies

DataSource Controls :: Get The Connection String Of Sql - Don't Have Sql Management

May 15, 2010

i work with sql database i want to connect to sql server i dont have sql manegment who could i c the connection string the palce of the sql that wen i write these comand sqlconnection con = new sqlconnection("the connection string")

View 4 Replies

DataSource Controls :: Better Way To Retrieve Connection String?

Apr 7, 2010

I have an app that connects to only one db for all of the data that the app has access to. My connection string is in the Web.Config file. In each of my DAL classes I have the following code that gets the connection string from the Config file. This works with no issues but I thought there might be a better way of doing this that I don't know.

If I wanted to change the name of the connection string that any of the DAL classes would use then I would have to change the name of the connection string in each of the files. I thought about creating a new class that would hold this then I could just instantiate a new instance of the class to access this with each of the DAL classes that needs access to it. Then if I needed to change the name of the connection string then it would only be in one place. I suspect there is an even better way of doing this that i don't know about.

[Code]....

View 3 Replies

DataSource Controls :: Open / Close Connection To DB?

May 4, 2010

When I'm using this to open Connection to DB,

Do I need to Close it at the end?

Or by using it, it close by itself?

using (SqlConnection cnn = new SqlConnection(connectionInfo))

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved