Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how should i connect it through c# code.I m using .net Framework 3.5 my database is in a remote server in Sql server 2008 ?
Posted
Updated 26-Sep-12 22:47pm
v2
Comments
Kenneth Haugland 27-Sep-12 1:12am    
wcf?
Sushil Mate 27-Sep-12 5:41am    
where you stuck?

try like this

In app.config file create one connection string
XML
<?xml version="1.0"?>
<configuration>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
  </startup>
  <connectionStrings>
    <add name="DBSqlServerConnectionstring" connectionString="Password=Your Password;Connection Timeout=0;Persist Security Info=False;User ID=userid;Initial Catalog=databasename;Data Source=servername;" />
  </connectionStrings>
  </configuration>

and access this in your form using
C#
public static string DBSqlServerConstringSQLAuth
        {
            get
            {
                return ConfigurationManager.ConnectionStrings["DBSqlServerConnectionstring"].ToString();
            }
        }
 
Share this answer
 
Comments
Ramesh Murugan 27-Sep-12 2:39am    
Thanks for yr reply buddy
I m using framework 3.5
so its not working
its showing me message Could not found schema 'supportedRuntime','version','sku'
M.R SAMEER BAIG 9-Apr-13 6:16am    
Can we call the sql command from app.config file to the form..???

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900