it was just a comment...but theoretically that is what you would have to do given the statements above, regardless of whether you are inserting or merely selecting...
Per the last post, couldn't it be assumed that by disposing of the SqlDataAdapter, the SqlDataReader would be closed and disposed of as well...thus making the connection available to another SqlDataAdapter?
Doesn't opening a connection every time you want to get data from a DB use a lot of resources? Basically that is saying that in one case of a switch statement, if I query out of the DB 5 times, I have to open and close 5 connections...
.Close() is not a method of the SqlDataAdapter...
i.e
SqlDataAdapter myAdapter = new SqlDataAdapter(
"SELECT * FROM TABLE "+
" ", myConnection);
DataSet ds = new DataSet();
myAdapter.Fill(ds);
myAdapter.Close(); <--- DOES NOT EXIST *****
myAdapter.Dispose();
I'm using an SqlDataAdapter to get data from a db. I open a connection, query out data using the adapter, then dispose of the adapter, then try to query out more data using another adapter and i get the following error...
There is already an open DataReader associated with this Connection...
I have a web app that I want to access active directory and give me the actual name of the person who is logged into the PC based on their username. I am using impersonation thru the web.config file.
Any idea on how I could go about looking at the active directory details of a person based on...
I've found a really cool way to have the column headings of a datagrid to be offset from the grid in a way to simulate fixing the column headings in an excel spreadsheet.
The problem I'm having is if the grid is not the first object on the page, say for instance there is a chart on the page...
I have also found that if I put in my own username and password (which sucks because it is in plain text) in the web.config file, it seems to work fine....
I have created an almost carbon copy of an application that I had originally written for asp.net 1.1 to v2.0 using VS 2005. On virtually identical configurations, the impersonation for the app on v2.0 doesn't seem to work.
It is on an intranet and I am getting prompted with a login dialog...
If you want to reload the list every time, use a session variable to capture your selection on the post back. In c# for instance:
if(Page.IsPostBack &&
DropDownList1.SelectedIndex != -1 &&
DropDownList1.SelectedIndex != 0) {
Session["VARIABLE"] = DropDownList1.SelectedValue;
}...
I am working with Caching data. Everything is fine up until 1 point in my application in which I want to cache a dataset. Prior to caching it, I have already cached numerous other things including other datasets. Without entering in the code to cache this particular thing, everything is fine...
The cache can be as simple or as complicated as you want it. I write in c# and began using cache just recently. You can add objects to cache with the add or insert method.
Cache.Insert("THE NAME YOU WANT TO CALL IT", "WHATEVER OBJECT YOU WANT TO PUT IN CACHE");
WHen you reference it, just...
I have an application that many people are accessing at various times. My problem is when 2 people are accessing the same portion of the application at the same exact time, one of the people will load the page successfully while the other will get an error such as "cannot find table 0". I'm...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.