Zdravim, potrebujem pomoct. V webconfigu mam nastavenu hodnotu connectionstringu
<configuration>
<connectionStrings>
<clear />
<add name="PersonalConnectionString" connectionString="Data Source=CZC2241WQX\SQLEXPRESS;Initial Catalog=Personal2;Persist Security Info=True;User ID=sa;Password=heslo" providerName="System.Data.SqlClient" />
</connectionStrings>
Potrebujem tuto hodnotu prebrat v code pre stlacenie tlacitka...
public partial class Sprava_Import : System.Web.UI.Page
{
private String strConnection = System.Configuration.ConnectionStringSettings["PersonalConnectionString"];
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSend_Click(object sender, EventArgs e)
{
... tu bude kod
}
ale ten zápis private String strConnection = System.Configuration.ConnectionStringSettings["PersonalConnectionString"]; mi vyhadzuje chybu. Ako je to správne ? Dík
|