|
i need help with this subject.
i want to set connectionString in web.config.
don`t know how!
|
|
|
|
|
|
|
ASP.NET 1.1
<appSettings>
<add key="ConnectionInfo" value="server=(local);database=Northwind;Integrated Security=SSPI" />
</appSettings>
Reading this string from code ~
ConfigurationSettings.AppSettings["ConnectionInfo"];
ASP.NET 2.0,
<connectionStrings>
<add name="YourConnectionString" connectionString="Data Source=YourSQLServer; Initial Catalog=YourDatabase; User ID=YourUserID; Password=YourPassword" providerName="System.Data.SqlClient" />
</connectionStrings>
Reading this string from code ~
<br />
if (((ConfigurationManager.ConnectionStrings("YourConnectionString") == null)<br />
|| _)) {<br />
ConfigurationManager.ConnectionStrings("YourConnectionString").ConnectionString.Trim() = "";<br />
throw new Exception("Connection Error");<br />
}<br />
else {<br />
conn.ConnectionString = ConfigurationManager.ConnectionStrings("YourConnectionString").ConnectionString;<br />
}
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
if u mean that u wanto to edit the ConnectionString within the code(Dynamiclay) u couldn't
only by the web configuration tool or manual
regrds
|
|
|
|
|
Add www.connectionstrings.com[^] to your bookmark. It is very helpful and can be of use if you work with numerous different databases.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
salam
kheyli khoshhal shodam ke tedade iraniha dar in talar har ruz bishtar mishe.
va amma moshkele shoma:
shoma mitavanid dar file web.config
yek klid mesle:
<configuration>
<appSettings>
<add key="connectionName" value="data source=(local);initial catalog=master;user id=sa;"/>
</appSettings>
</configuration>
ijad konid , jahate estefade az an:
private SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["connectionName"]);
dar har gesmat az code garar dahid.
dar zemn behtare ruye foldere Bin right click karde va componente System.Configuration ra add konid.
My Real Email:
abolfazl585@yahoo.com
We Can Do Anything, If We Want It
|
|
|
|
|
Hi, I have a custom login control into one UpdatePanel.
when user click button for login, i disable button and show a waiting gif by add_initializeRequest unitil end of ajax process.
then enable button and hide gif in add_endRequest.
Until now there is no problem. but i want make modal (disabled with fade effect)the page in this duration.
please help me how i can do it?
Thank you advance
|
|
|
|
|
|
Dear Vasudevan Deepak Kumar,
I am not member of http://www.experts-exchange.com, would you please zip the page and send to me it.
mortezasoft[at]gmail.com
thank you
|
|
|
|
|
i am adding textbox to a column of gridview dinamically.
1 - if i use from OnRowCreated, its not applying in grid binding and must be postback page to apply it.
2 - if i use from OnDataBound, its apply in grid binding but lost box's in post back
codes:
1 - OnRowCreated
{
e.Row.Cells[3].Controls.Add(new TextBox());
}
2 - OnDataBound
{
foreach(GridViewRow row in grid1.Rows)
row.Cells[3].Controls.Add(new TextBox());
}
We Can Do Anything, If We Want It
|
|
|
|
|
You have to use Templates to do it
|
|
|
|
|
can you say me that how to add dinamic textbox to templatefield
We Can Do Anything, If We Want It
|
|
|
|
|
|
hi,
I have a problem reading DateTime.Now in my web application on Windows vista. It's read in an incorrect format (dd/mm/yyy), although my regional settings are all (united states) and the date format is set to (mm/dd/yyyy)?
so why is it read in this format in internet explorer? Am I missing something...I'm new to windows vista so I dunno!
|
|
|
|
|
Then forcefuly Format the date
DateTime dt = DateTime.Now();
String date = dt.Month + "/" + dt.Day + "/" + dt.Year;
I Think there are also better Solution.
Ps. Is your computer also a testing server? That setting depends on the server computer, where these files are executed. This kind of problem is very often to come by when attempting to insert into mysql or other database. I Don't know if i typed it correctly the example, but at least you get the idea how to solve. Without having to change the setting for every server you inted to run it
Edit: This problem doesn't exsist in Vista Only, It coud also exsist in other platforms. (I Had same problem with PHP on Linux - When i tried linux)
|
|
|
|
|
well I can't use this solution coz the whole project is written like that..in several other pages..it's actually working ok on windows xp and I even made the same settings I have on windows vista..I hope there's something else to do in the settings of vista to solve this problem!
thnx anyway for the reply
|
|
|
|
|
Did you check on Windops Vista date format setting?
Maybe it is diffrent format, than xp Even if you selected US, Try manualy edit date format
|
|
|
|
|
Nada Adel wrote: on Windows vista
Your Computer's Regional Settings has an upper hand. You can force a DateTime's IformatProvider right?
|
|
|
|
|
try this
System.DateTime.Now.ToString("MM/dd/yyyy");
ToString() is overrriden in DateTime Class so u can manage the Format by using the above method.
|
|
|
|
|
ASP.NET does not run under the account you are currently logged in as. It runs under the .NET account. You can check the short date format for all of your acounts in the registry editor by looking at 'HKEY_USERS > [USER] > Control Panel > International > sShortDate' for each user account.
|
|
|
|
|
thank you, i think that's what I was looking for
|
|
|
|
|
i cant run my program, there's an error:
Type 'BOOK_Locator.Dataset1' is not declared
in codes:
Friend WithEvents DataSet11 As BOOK_LOCATOR.DataSet1
i have connected my database in connection wizard properly but why there's an error in it? how can i fix?
|
|
|
|
|
Don't put a useless subject like "please help me". Almost every thread here is about someone needing help, so it doesn't do anything at all to distinguish the thread from others.
Don't repost the same question. Especially not so soon after the previos one.
---
single minded; short sighted; long gone;
|
|
|
|
|
make sure of the spelling of the Object name.....otherwise try
Clean Soloution from the Bulid Menu
|
|
|
|