Link to home
Start Free TrialLog in
Avatar of 5281
5281

asked on

How to connect SQL Server in WCF services

How to connect to SQL Server in WCF services?  How to call the connection string which is in web.config file?

I need sample code for calling(accessing) database in WCF services and sample code for web.config connection string.  


Thank you.
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

For config, use ConfigurationManager class

http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.appsettings.aspx

For DB, same as any other application type. Create a connection and execute SQL.
Avatar of 5281
5281

ASKER

Could you give me a sample code in VB.Net using ConfigurationManager to connect database and output data, and sample code for connection string in web.config.
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial