Possible Duplicate:
Programmatically Changing SQL Server Settings
To set up a network connection between a C # client application and SQL Server 2008 R2, I know what needs to be done manually, my problems are how to do the following steps in C # code!
- Set TCP / IP Enabled for a server instance, for example
MSSQLSERVERR2. Reboot my SQL Server engine.
I can perform other steps of SQL queries:
Add user and give administrator permission.
CREATE LOGIN momtahen
WITH PASSWORD = '123'
EXEC master..sp_addsrvrolemember @loginame = N'momtahen',
@rolename = N'sysadmin'
Set Mixed Authentication Mode for my SQL Server.
EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE',
N'Software\Microsoft\MSSQLServer\MSSQLServer', N'LoginMode', REG_DWORD, 2
I need C # code or an SQL query that I could execute using C #.
Also I have to mention that I saw the following question and do not help!
, . , ?