How to fix a database in one simple step

DECLARE @db nvarchar(50) set @db=’my.datab.name’ –close all connections DECLARE @SPId int DECLARE @CMD varchar(100) DECLARE my_cursor CURSOR FAST_FORWARD FOR SELECT SPId FROM MASTER..SysProcesses WHERE DBId = DB_ID(@db) AND SPId <> @@SPId OPEN my_cursor FETCH NEXT FROM my_cursor INTO @SPId WHILE @@FETCH_STATUS = 0 BEGIN SELECT @CMD = ‘KILL ‘ + CAST(@SPId AS varchar(10)) EXEC (@CMD) […]

How to read a .ini file in .Net

There is no ready-made class, so you’ll have to call the Windows API [DllImport(“KERNEL32.DLL”, EntryPoint = “GetPrivateProfileStringW”, SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] private static extern int GetPrivateProfileString( string lpAppName, string lpKeyName, string lpDefault, string lpReturnString, int nSize, string lpFilename); [DllImport(“KERNEL32.DLL”, EntryPoint = “WritePrivateProfileStringW”, SetLastError = true, CharSet = […]

Bad Behavior has blocked 258 access attempts in the last 7 days.