|
Do you mean you want to programmatically add/modify the connection string stored in the web.config file?
Regards - J O H N -
|
|
|
|
|
yes
i want to programmatically add/modify the connection string stored in the web.config file
B asharatA li
Internee
METESYS Lahore
Pakistan
|
|
|
|
|
Create a XMLDocument Object and Load the XMLFile (web.config) into it, then Navigate through the Nodes and find the attribute of the corressponding Connection string Node in the config file and modify the inner XML of the attribute.
Regards - J O H N -
|
|
|
|
|
Note that changing the web.config will force your app domain to restart.
|
|
|
|
|
then how can i resolve this issue
B asharatA li
Internee
METESYS Lahore
Pakistan
|
|
|
|
|
If you must be able to change connection string programatically, then i would recommend storing them in a separate config file and writing your own code to access them.
|
|
|
|
|
Perhaps you should ask about what you are trying to accomplish, rather than how to implement it the way that you think that it should be implemented...
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
i use this code for adding pr modifing connection string.
Dim mydoc As System.Xml.XmlDocument = New System.Xml.XmlDocument<br />
mydoc.Load(Application.StartupPath & "\..\..\app.config")<br />
Dim node As System.Xml.XmlNode = mydoc.SelectSingleNode("configuration/connectionStrings/add")<br />
Dim attribute As System.Xml.XmlAttributeCollection = node.Attributes<br />
attribute(1).Value = ConnectionString<br />
mydoc.Save(Application.StartupPath & "\..\..\app.config")<br />
but Paddy Boyd said above
Note that changing the web.config will force your app domain to restart.
so i want to resolve this issue
B asharatA li
Internee
METESYS Lahore
Pakistan
|
|
|
|
|
BasharatAli wrote: so i want to resolve this issue
First of all that is not a issue. That is one of the property of the .NET Framework that if you make any changes to the Configuration file, your webapplication will automatically restart since all the application level setting resides in the web.config file. By the way why you are programmatically modifying the web.config file. You can have multiple Connection strings in the Web.config file and access it in your code whichever you want.
Regards - J O H N -
|
|
|
|
|
This is still just a question about how you implement the specific solution that you have chosen for your problem. Noone knows what is it that you are trying to accomplish really.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
i'm trying to generate connection string dynamicaly.
B asharatA li
Internee
METESYS Lahore
Pakistan
|
|
|
|
|
i'm trying to generate connection string dynamicaly mean every time new server name and DB.
B asharatA li
Internee
METESYS Lahore
Pakistan
|
|
|
|
|
Ok, why do you want to save the connection string in web.config? Why not just create a connection string settings object and use it?
ConnectionStringSettings settings = new ConnectionStringSettings("name...", "connection string...", "System.Data.SqlClient");
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Accutaly i hve used dataset component which read connectionstring from config file and i want to change that connectionstring programticaly to specify different server, user id and password so that's why i'm trying to change it.
anyways i hve just done it by another technique. so thanks all of you for your time
B asharatA li
Internee
METESYS Lahore
Pakistan
|
|
|
|
|
BasharatAli wrote: Accutaly i hve used dataset component which read connectionstring from config file
You could just set the connection string from code behind instead of specifying it in the markup code. You are trying to work around limitations that doesn't exist...
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
How to write the coding for RadioButton onclick event
|
|
|
|
|
ps.srinivasan wrote: How to write the coding for RadioButton onclick event
server-side You can write the code on OnCheckedChanged event.
Clisent-side you bind a javascript function to the client onclick event.
Regards - J O H N -
|
|
|
|
|
Hi all,
Iam developing a .net 2.0 web application where i have dataentry pages to enter details for a case. Each case has a unique reference. I need to prevent users from enetering/editing/viewing this certain reference if another user is viewing/editing it. How can i do that?
N.B. i have tried a bit field in the database but iam not being able to maintain page closing/leave to release the page.
thanks
|
|
|
|
|
samerh wrote: but iam not being able to maintain page closing/leave to release the page.
You can use AJAX to do this, but you'd still be best to impliment a timeout, because if someone turns off their PC, there's literally nothing you can do.
A bit field and a date/time for a timeout is the only way to do this. Storing the Id of the person who has the lock also makes sense ( replace the bit with an int, using 0 for no lock, or a user Id, for example )
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks for ur reply.
Storing the id of the user is a good solution, however iam not being able to know when the user leaves the pages of that reference, taking into consideration that this reference has around 25 detail pages and i need to keep locking this reference as long as this user is in one of these pages. My issue is that i am facing timeouts and how can i know when a user eneters a second reference to release the first one and what if he wants to use them both!!!
May be as said there is no one way to do that. I will try to check the query string and if the refId is different i will release the reference. Still i didnt test it.
|
|
|
|
|
samerh wrote: however iam not being able to know when the user leaves the pages of that reference
Corrent. You have to add a timeout because there is no way to be sure that the user has left the page.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi,
I put a html file with in the tag of the table and i want to run this html file when i run my application. that means when i run the application i want the output of the html file with in a table cell.
I am using aspdotnet(using vb.net).
please send me some solution for that.
thanks and regards
bikash pattanayak
|
|
|
|
|
You can use a frame to embedd a HTML page in your app. Or if it's an HTML snippet, you can put an asp:Literal in your page and assign the HTML to it.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
hi,
i hv applied some xml documentation for c# using /// (three forword slashes) but how can i do the same in vbdotnet. now i am using vbdotnet 1.1
|
|
|
|
|
I don't think VB.NET supports it. You could try the VB forum ( this question has nothing to do with ASP.NET )
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|