Ms sql?

Topics: Developer Forum, User Forum
Aug 30, 2008 at 10:53 PM
Hello!
I can`t connect to my ms sql server on my host server, I do it like N2 cms guide telme, to change connection string in web_config like this:


<connectionStrings>
    <!-- Some connection string examples
  SQLite:    <add name="N2CMS" connectionString="Data Source=|DataDirectory|\n2.db;Version=3;New=True;" providerName="System.Data.SQLite"/>
  SQL Server 2005: <add name="N2CMS" connectionString="Server=(local);Database=N2_Templates;Integrated Security=SSPI"/>
  SQL Express 2005: <add name="N2CMS" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\N2.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
  SQL Server 2000: <add name="N2CMS" connectionString="Data Source=212.97.133.33;Database=Langorm_k2;User Id=Langorm_admin;Password=4938xxx;Network Library=DBMSSOCN;" providerName="System.Data.SqlClient"/>
  MySQL:    <add name="N2CMS" connectionString="Data Source=MySQLServer;Database=MySQLDatabase;User Id=MySQLUser;Password=MySQLPassword;" providerName="MySql.Data.MySqlClient"/>
  -->
    <add name="N2CMS" connectionString="Data Source=|DataDirectory|\n2.sqlite.db;Version=3;New=True;" providerName="System.Data.SQLite" />
  </connectionStrings>
what are rong here??



It`s there any guide to add a community forum to N2cms??

Keep the good work, N2cms it`s very simple for asp newbees!


Aug 31, 2008 at 7:05 AM
The code you posted is for a connection to SQLite.
Please read here: http://www.n2cms.com/Documentation/Connection%20strings.aspx

Ii your example you have commented out (comments are between <!-- en --> everything but SQLite.
For MS SQL Server 2005 It should read

<connectionStrings>
      <add name="N2CMS" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\N2.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>
  </connectionStrings>

And then it still does not work because you have to set the Connectionstring parameter.
More info ont that can be found here: http://www.connectionstrings.com/?carrier=sqlserver2005
Aug 31, 2008 at 8:43 PM
Hello! thanks fore the reply!

I dosen`t understand! can you gve me a example for the connection in webconfig?

I have a remote sql 2005 server !
Coordinator
Aug 31, 2008 at 9:10 PM
Try something like this:

<connectionStrings>
    <add name="N2CMS" connectionString="Server=SQLSERVERNAME;Database=DATABASENAME;Uid=USERNAME;Pwd=PASSWORD;"/>
</connectionStrings>