|
There are several connectionstrings in the web.cofig file.
<add name="DBConnection1" connectionString="Data Source=server1;Initial Catalog=database1;User Id=username;Password=password" providerName="System.Data.SqlClient"/>
<add name="DBConnection2" connectionString="Data Source=server1;Initial Catalog=database2;User Id=username;Password=password" providerName="System.Data.SqlClient"/>
...
...
I can retrieve each one of them by using the following code . i.e.
string strConn = ConfigurationManager.ConnectionStrings["DBConnection1"].ConnectionString;
Question:
How can I retrieve all the connectionstrings into one array of strings so that I can populate the names of the databases into a dropdown control? I ask because the list of the connectionstring in the web.config can grow. So I need a way to retrieve all the connectionstrings without hardcoding the connectionname as I have done above.
Any thoughts please?
Thanks
|
|
|
|
|
My first thought is load the web.config into and xmldocument and parse it yourself using SelectNodes.
|
|
|
|
|
Any other thoughts apart fro mxmldocument?
Thanks
|
|
|
|
|
<asp:DropDownList ID="ddl" runat="server"></asp:DropDownList>
ConnectionStringSettingsCollection a = ConfigurationManager.ConnectionStrings;
ListItem lst = new ListItem();
foreach (ConnectionStringSettings s in a)
{
lst = new ListItem(s.ConnectionString, s.ConnectionString);
ddl.Items.Add(lst);
}
ddl.Items.RemoveAt(0);
you can use any loop once it is populated in ConnectionStringSettingsCollection.
it populates one connection string from machine.config file. so i have removed 1st one.
Hope this will be helpful for u.
|
|
|
|
|
Hi,
In my Web Application I have my database on central server. There is one table A which is associated with 10-12 table. i.e. A tables primary key used as Foreign Key in other table. I used web service.
Now I have other application(Desktop Application) where I used web service. Now in that case I directly uses web service where in that I directly connect to the central database.
Now my problem is I have my 3rd application(Desktop application) where I dont want to connect directly to the central database. Means at first time its Ok to connect to the central database but for other manupulation it wont connect to the central database. I want to done it locally. Once all finish it will then update to the central database with all tables updated records.
Both 2nd and 3rd application run simultaneously. So because of local applications data is not updated 2nd application which is running will also provide the same primary key as local applications data once database manipulation done.
So if I integrate these database then it will overwrite the data or my 2nd applications data will lost.
I am using cache concept. But there is another problem of using caching if shut down the computer or power interrupt it will again lost the data.
So what can i do?
Thanks
Sjs
|
|
|
|
|
You can have two ID in Tables
1 is LocalID and another is CentralID
Might be the solution.Best Regards,
Chetan Patel
|
|
|
|
|
Thanks for the reply.
Now just I will explain what exactly problem is
My A table is very important. Now when my 2nd application run and when I login then automatically 1 entry is inserted into A table. Some work done on windows application and when going to next level it will again insert 1 entry to A table So if my A table start with 19th entry it will finish with 20th entry. There are some process in windows application where each time 1 entry inserted into A table. So near about 4-5 time each entry inserted.
Having Same application 3rd application running locally with same database manupulation. i.e. one entry inserted after login. so if after 2nd aplication login if my local 3rd application run and once user login then it will automatically generate next primary key i.e.20 at local machine which is already there on server database. And All my other forms which is depends on that primary key.
If I going to update server database with local entry then it will conflict.
Thanks
Sjs
|
|
|
|
|
Hi Everyone,
I am trying to create a simple customer object with firstname, lastname and dateofbirth
properties.
Then I would like to populate 4 of them or so and put them into a collection
and then populate them onto a page for display with a repeater control.
As I am not very expert in ASP.NET.
Please let me know your thoughts with sample code.
Thnaks
|
|
|
|
|
<asp:Repeater ID="Repeater1" runat="server" >
<HeaderTemplate >
<table width="100%">
<tr style="background-color:Black; color:White; font-weight:bold" >
<td >firstname</td>
<td >lastname</td>
<td >dateofbirth</td>
<td ></td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td height="30px"><%#DataBinder.Eval(Container.DataItem,"firstname") %></td>
<td height="30px"><%#DataBinder.Eval(Container.DataItem,"lastname")%></td>
<td height="30px"><%#DataBinder.Eval(Container.DataItem,"dateofbirth")%></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
|
|
|
|
|
What have you tried so far? No one is just going to give you code.
Mod: okay, I was wrong: looks like someone did just give you some code. Must be your lucky day!.Tychotics: take us back to the moon
"Life, for ever dying to be born afresh, for ever young and eager, will presently stand upon this earth as upon a footstool, and stretch out its realm amidst the stars."
H. G. Wells
|
|
|
|
|
Hi,
I am beginner to ASP.Net.
I just learned Application[] class and session[] class. My question is which one is better? And where i have to use application[] object and where i have to use session[].
I have one more doubt:
I have two asp pages,
Page 1: take the choice from the user where i have three check boxes.
check 1. person names start with 's'
check 2. person names starts with 'a'
check 3. person name starts with 'g'.
So page one is contains above three check boxes. When user selects check box and submitted, it goes to second page where i have to write code for get the values from data base based on check boxes user selected.
For this kind of problem can i use Application[]. Or any other method to write solution for this.....
Thanks in advance .....To invent something, you need a mountain of junk in your mind.
---------------------Thomas alva edison
|
|
|
|
|
<blockquote class="FQ"><div class="FQA">sampath-padamatinti wrote:</div>where i have to write code for get the values from data base based on check boxes</blockquote>
then Redirect to 2nd page use query string for id of check box...
get the values from db by using the id of check box from 1st page
|
|
|
|
|
Application is Shared among all the users so if you want to seperate the storage for each user use Session
Ex.// If you want to get Count of All Users then use Application
And if you have to store UserName then use SessionBest Regards,
Chetan Patel
|
|
|
|
|
you can use Session object to passing parameter among pages.
if you want to share this info for all users in your application, the Application is the choice.
|
|
|
|
|
Hello friends,
I want to develop the drag and drop functionality in my web application
I found better solution to implement using webparts. But i have one issues, the drag highlight style is not looking good while drag and drop from Zone1 to Zone2.
I want to change the drag highlight style.
How to change the drag highlight style while drag and drop
using webparts?
Thanks in Advance.damodharan
|
|
|
|
|
hi all
I have problem regarding Forms Authentication .
it's working fine in IE browser but it does not work in mozilla firefox ...
In IE, when i click on LOGOUT button, it does log out ..and when i click on "back" button of IE browser , it doesn't redirect back to logged in form .instead it remains on "login.aspx" page....this doesn't work in firefox.
what could be the error???..plz help
|
|
|
|
|
Did you think no one would notice you posting the same question as two different users? I know the language. I've read a book. - _Madmatt
|
|
|
|
|
dude if u dnt know the answer then keep ur mouth shut
|
|
|
|
|
hi all
I have problem regarding Forms Authentication .
it's working fine in IE browser but it does not work in mozilla firefox ...
In IE, when i click on LOGOUT button, it does log out ..and when i click on "back" button of IE browser , it doesn't redirect back to logged in form .instead it remains on "login.aspx" page....this doesn't work in firefox.
what could be the error???..plz help
|
|
|
|
|
|
Dude, learn how to speak and type before answering. Text speak is for children not professionals. Understood
<hr />I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi there,
I'm using ASP.NET to send newsletter to some email addresses. the news letter is an html file with an image in its background. but the image cannot be displayed in Outlook 2003,2007.
Is it completely impossible to displaythe background in Office Outlook?
if not, what's the solution?
|
|
|
|
|
Outlook displays these images fine. However any end user can set outlook to not display images by default. Personaly I never want to see a background image in an email. It reduces readability and increases the size of the email. But each to their own.
However, I suspect your problem is on the sending end rather than the receiving end. The image must be properly embedded in the email, and I am not sure that .Net does that particularily well natively. I have had no end of trouble generating emails from word mail merges and having the images lost on the way through.
|
|
|
|
|
hi, i am new in asp.net
i want to create webservice which used as an intermediate between webportal and real system.
means online bookings which are done through my client's webportal i want to check that user's id in my system and if he is new then ask him for registration if he is older user then check his id and password in my system's database and do the remaining transaction for that i want to create the webservice which is used to intermediate media between client's web portal and my system..
how can do that, will please explain me.... please i am new so didnt know how can i do????
|
|
|
|
|
i teach u dotnet , u teach me English
my msn : fly1126@live.cn
|
|
|
|