|
Mogaambo wrote: can i used where i want to access database.
That would mean that only one thread at a time can access the database. You would have to use locking so that only one thread at a time uses the singleton, which totally defeats the purpose of using a singleton in the first place.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
|
Mogaambo wrote: Will it means that if two user request a page then. will there be any race condition.
Yes.
|
|
|
|
|
Mogaambo wrote: Will it means that if two user request a page then. will there be any race condition.
I would not call it a race condition. The connection object handles the situation just fine, and throws an exception if another thread tries to use it while it's already in use.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi, I am developing a Login page.In doing so I've encountered a problem of which I've no clue.
All the codes are running properly but an exception is thrown in a line
Response.Redirect("Home.aspx").
The exception says
Source = Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.
Please help me out.
ARINDAM
|
|
|
|
|
Are you using Try..Catch..Finally Block???
Anyway try this
Response.Redirect ("Default.aspx", false);
Arun J
|
|
|
|
|
Thanx friend...It works..But still i am wondering why it happened.Can you explain a bit?B'coz this kind of code i've used several times before,but never got an exception like this.
ARINDAM
|
|
|
|
|
Was that a ThreadAbortException ? Response.Redirect calls Response.End internally which causes the ThreadAbortException . So passing the boolean parameter to Response.Redirect tells not to call end internally.
Can you show the piece of code? Probably we can give some better suggestions.
|
|
|
|
|
Hi,
I am getting the same error at the following line of code:
SPFolder gFolder = web.Folders[documentLibraryName].SubFolders["DeckPlans"];
Comple code is as follow:
public static string GetDeckPlanDocument(string ship)
{
String documentLibraryName;
string deckPlanFile = string.Empty;
documentLibraryName = Constants.Constants.DOCUMENT_LIBRARY_NAME;
SPSite site = SPContext.Current.Site;
using (SPWeb web = SPContext.Current.Site.RootWeb)
{
string content = string.Empty;
SPQuery query = new SPQuery();
SPList myDocList = web.Lists[documentLibraryName];
SPFolder gFolder = web.Folders[documentLibraryName].SubFolders["DeckPlans"];
query.Folder = gFolder;
SPFileCollection filesColl = gFolder.Files;
query.Query = "<Where><Eq><FieldRef Name='Ship'/>" +
"<Value Type='Text'>" + ship + "</Value></Eq></Where>";
//query.Query = "<Query><QueryOptions><Folder>" + @"DeckPlans" + "</Folder></QueryOptions></Query>";
//For nested folder structureSPListItemCollection itemCol = splist.GetItems(spquery)
SPFolder spFolder ;
SPListItemCollection items = myDocList.GetItems(query);
foreach (SPListItem item in items)
{
deckPlanFile = item.File.ToString();
}
}
return deckPlanFile;
}
Please help me on this.
Thanks in advance.
|
|
|
|
|
ARINDAM1981 wrote: But still i am wondering why it happened.
You are not showing the actual error message, but the part of the additional information that tells you that the source code where the exception was thrown can not be shown.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Ya It worked For Me.
Response.Redirect ("Default.aspx", false);
Thanks.
|
|
|
|
|
i have a sql query when this run the query then i don't know how expand the time. but i have been return message when query is done. i am using this query on aspx page. when i click the button then this run query. page processing done. query already running.
now my question is that I want when query is done the my page processing is done. e.g both done same time.
how it is possible. please help me.
|
|
|
|
|
What i understand is that you want your query to finish first and then the page is processed. If this is so then on page load call the query synchronously and wait for its completion. And after it is completed proceed to next step. i.e processing of page
Ahsan Ullah
Senior Software Engineer
MCTS 2.0
|
|
|
|
|
Wait for the completion of the query,then start processing the page.
One thing,if your query taking too much time,say more than 2 sec then it is not good and as per best practices so improve the performance of the query
Cheers!!
Brij
|
|
|
|
|
Hi,
I am looking for a Layout option in VS 2008 to absolute the position so that i can move the control anywhere in the form.
Like http://pics.bbzzdd.com/users/clamum/vs2005absoluteposition.gif[^]
In VS 2008 i found this way out
Tools -> Options, and set HTML Designer -> CSS Styling to "Change positioning to absolute...", but in order to drag the element around you have to drag it by the little white tab on top, and not the element itself.
But the above method does not work to drag button, it works only for textbox..
Any clue ?
Thanks
Andy
|
|
|
|
|
I worked on a project this past summer with another programmer who showed me how he created a method in an object that returns a sqldatareader. He had used it in a winform, so we tried it in a web site so we wouldn't have to write the same reader code over and over again. While we were writing the method, we noticed that we couldn't tell the connection to close without an error being thrown. Now, does the sql connection need to stay open while you are reading from the sqldatareader?
|
|
|
|
|
last time i checked it does, you also cannot have more than one SqlDataReader per connection.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Yes, but can I close the connection before I read the data in the reader? How exactly does the reader work?
|
|
|
|
|
i dont know exactly how the reader works, but you need to close the reader before you close the connection, unless something has changed, i tried that once a long time ago and got an exception and have not tried it since. If ihad to guess i would think that the reader keeps the result set cached on the dbserver somwhere and uses the connection to go get whatever you tell it to go get, i think odbc works ina similar fashion, i could be and probably am wrong about some things but i have not looked into the specifics of how in a while, and when i did it was for .net 1.1 not the newer versions.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Aptiva Dave wrote: does the sql connection need to stay open while you are reading from the sqldatareader?
Yes.
The data reader doesn't contain the result from the database, it only reads one or a few records at a time.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
you might be using the datareader which fetches the data in loop.
|
|
|
|
|
I'm using a treeview control.
The treeview is on a masterpage, right beside it it has the container.
The user uses the treeview to navigate to aspx pages using this masterpage.
But on each page load the treeview nodes are collapsed to original state.
I want to maintain the nodes expanded state.
How can I do that?
modified on Tuesday, November 11, 2008 1:49 PM
|
|
|
|
|
hi
i think that you configured the TreeView contorl's ViewState property to false.
you can change it to true.
bye.
Mohammad Khansari
|
|
|
|
|
I just want to maintain the treeview depth between requesting pages and not to go back to the expandDepth specified in TreeView property window.
|
|
|
|
|
hi
if you configured treeview's viewstate property to false then treeview state back to it's default through requests.
so you should change the viewstate property to true then you can maintain treeview state through requests.
if you meant anything else tell me my dear.
bye.
Mohammad Khansari
|
|
|
|