Hello
i was tring to a connecto to a database but i have always this erros
Message 4 Impossible to find the informations the element for the schema 'http://schemas.microsoft.com/.NetConfiguration/v2.0:add'.
Message 2 Impossible to find the informations the element for the schemat 'http://schemas.microsoft.com/.NetConfiguration/v2.0:appSettings'.
Message 3 Impossible to find the informations the element for the schema 'http://schemas.microsoft.com/.NetConfiguration/v2.0:connectionStrings'.
Message 4 Impossible to find the informations the element for the schema 'http://schemas.microsoft.com/.NetConfiguration/v2.0:add'.
my code
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<appSettings/>
<connectionStrings>
<add name="DatabaseConnection" connectionString="Persist Security Info=False;Integrated Security=SSPI;database=MyDatabase;server=(localhost);" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation debug="true"/>
<authentication mode="Windows"/>
-->
</system.web>
</configuration>
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class application : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{
Connect_to_bdd();
}
protected void Connect_to_bdd()
{
ConnectionStringSettings settings;
settings = ConfigurationManager.ConnectionStrings["DatabaseConnection"];
if (settings != null)
{
Console.WriteLine(settings.ConnectionString);
}
else
{
try
{
SqlConnection oConnection = new SqlConnection(settings);
oConnection.Open();
Console.WriteLine("Etal de la connection" + oConnection.State);
oConnection.Close();
}
catch (Exception e)
{
Console.WriteLine("L'erreur suivante a été rencontrée:" + e.Message);
}
}
}
}
Thanks for help
Hi Bolo,
It seems that your IIS settings hasn't been updated to version 2.0 .
You may enter the folderC:\WINDOWS\Microsoft.NET\Framework\v2.0.50215 in DOS mode and run "aspnet_regiis.exe -i ".
If this does not answer your question, pls feel free to reply. Thanks!
|||
Hello,
i tested but i have always same message :(
regards
No comments:
Post a Comment