Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.5
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 26-Sep-12 20:07pm
Edited 26-Sep-12 23:47pm
v2
Comments
Kenneth Haugland at 27-Sep-12 1:12am
   
wcf?
Sushil Mate at 27-Sep-12 5:41am
   
where you stuck?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

try like this
 
In app.config file create one connection string
<?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
public static string DBSqlServerConstringSQLAuth
        {
            get
            {
                return ConfigurationManager.ConnectionStrings["DBSqlServerConnectionstring"].ToString();
            }
        }
  Permalink  
Comments
Ramesh Murugan at 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'
Member 9975010 at 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)

  Print Answers RSS
0 OriginalGriff 5,170
1 DamithSL 4,357
2 Maciej Los 3,750
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,851


Advertise | Privacy | Mobile
Web03 | 2.8.141216.1 | Last Updated 29 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100