Skip to main content

Posts

Showing posts from February, 2010

Export SPROC query to text file in SQL Server

sometime i have need to documented my Stored Procedured query often i'm using sp_helptext SPROC_NAME then copy paste the result in notepad and save it. It consume alot of time if u using alot SPROC found another way around using sqlcmd command, something like DECLARE @sql AS NVARCHAR(1000) SET @sql = 'sqlcmd -S (local) -d "DB_NAME" -q "sp_helptext SPROC_NAME" -o 'OUTPUT_FILE' exec master..xp_cmdshell @sql after some tweaking :D, i decided to wrap in SPROC /* =========================================================== Author: eRiCk WiDyA Description: Export SPROC syntax to text file Date: 10 Feb 2010 Usage: exec ExportSPROCToTextFile 'C:\', '[DB NAME]', 'sp_some%' Param: @FilePath : must exists first before run @DatabaseName : use [] @SPROCCriteria : SPROC name that contains those words =========================================================== */ CREATE PROC ExportSPROCToTextFile @FilePath AS NVARCHAR(50), @DatabaseName AS NV

Calling Click Event from a Control in .NET

Event in .NET have this thing (not sure what to call it :D) Private Sub ControlName_Click (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ControlName.Click so whenever u want to call the method inside it..u need to passing something like this ControlName_EventName (nothing, nothing) or create another function inside it then call that function from elsewhere however, i just found out yesterday that u can use PerformClick() method that call the click event :D ControlName.PerformClick() the magic will begin :D CU

Only allow one instance Application in .NET

hi all, in VB6 u can use something like this if App.PrevInstance in .net u can't do simillar u must use Mutex 'in VB 'Form Declaration Variable Private oMutex As Mutex Private Function isInstanceCanRunning() As Boolean oMutex = New Mutex(False, "SINGLE_INSTANCE_APP_MUTEX") If oMutex.WaitOne(0, False) = False Then oMutex.Close() oMutex = Nothing Return False Else Return True End If End Function see u