|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Web.config: connection stringsI am beginner. Could you help me please how to connect to SQL Sever using connection string in Web.config? I have: <configuration> <appSettings/> <connectionStrings> DataSource=PC\SQLEXPRESS;User ID=sa;Password=sqlserver; Initial Catalog=DemoDotNET </connectionStrings> and code behind: private string ConnectionString { get { SessionStateSection sss = new SessionStateSection(); return sss.SqlConnectionString; } } but I got ConnectionString == "data source=localhost;Integrated Security=SSPI" instead of text from Web.config. How to programme it corectly? Thank you very much! /RAM That was a nonsense what I wrote.
I tried this way: <connectionStrings> <MSAccess>Provider=Microsoft.Jet.OLEDB.4.0;Data Source=App_Data/DemoDotNET.mdb;User ID=;Password=;Mode=Share Deny None</MSAccess> <SQLServer>DataSource=PC\SQLEXPRESS;User ID=sa;Password=sqlserver;Initial Catalog=DemoDotNET</SQLServer> </connectionStrings> and code behind reading XML Web.config, but my elements <MSAccess> and <SQLServer> are considered invalid. Could anyone tell me please how to do it corectly? Thank you. BTW, my SQL connection string is not OK, I think... /RAM |
|||||||||||||||||||||||