Windows Form Programming User Controls Custom Controls c# code snippets c# vb.net Tutorials
using System; using System.Collections.Generic; using System.Text; using System.Diagnostics; namespace StopWatchExample { class Program { static void Main(string[] args) { Stopwatch sw = new Stopwatch(); sw.Start(); Console.WriteLine("Stop Watch Start....\n"); for (int i = 1; i <= 5; i++) { Console.WriteLine(i + "\n"); } sw.Stop(); Console.WriteLine("Stop Watch Stopped:"); Console.WriteLine("Total Time: {0}", sw.Elapsed); Console.ReadLine(); } } }
public Form1() { InitializeComponent(); Skybound.Gecko.Xpcom.Initialize("Path To the xulrunner directory [Extracted from the Second Downloaded File]"); // for example "c:\\xulrunner\\" }
private void Form1_Load(object sender, EventArgs e) { geckoWebBrowser1.Navigate("www.google.com"); }
private void btnStop_Click(object sender, EventArgs e) { geckoWebBrowser1.Stop(); }
private void btnRefresh_Click(object sender, EventArgs e) { geckoWebBrowser1.Refresh(); }
private void btnSavePage_Click(object sender, EventArgs e) { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = " Html File | *.html"; if (sfd.ShowDialog() == DialogResult.OK) { geckoWebBrowser1.SaveDocument(sfd.FileName); } }
declare @string varchar(500) set @string = 'ABC,DEF,GHIJK,LMNOPQRS,T,UV,WXY,Z' declare @pos INT declare @piece varchar(500) -- Need to tack a delimiter onto the end of the input string if one doesn’t exist if right(rtrim(@string),1) <> ',' set @string = @string + ',' set @pos = patindex('%,%' , @string) while @pos <> 0 begin set @piece = left(@string, @pos - 1) -- You have a piece of data, so insert it, print it, do whatever you want to with it. print cast(@piece as varchar(500)) set @string = stuff(@string, 1, @pos, '') set @pos = patindex('%,%' , @string) end
IF EXISTS ( SELECT * FROM sysobjects WHERE id = OBJECT_ID(N'[dbo].[sp_GetRowsCountForAllTables]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1 ) DROP PROCEDURE [dbo].[sp_GetRowsCountForAllTables] GO CREATE PROCEDURE sp_GetRowsCountForAllTables @DBName VARCHAR(128) = NULL AS SET nocount ON IF @DBName IS NULL SET @DBName = DB_NAME() CREATE TABLE #a ( TableName VARCHAR(128) , norows INT NULL , id INT IDENTITY(1, 1) ) DECLARE @id INT , @maxID INT , @TableName VARCHAR(128) , @FKName VARCHAR(128) , @cmd NVARCHAR(1000) , @rc INT , @spcmd VARCHAR(1000) SET @cmd = 'exec ' + @DBName + '..sp_executesql N''insert #a (TableName) select TABLE_NAME from information_schema.tables where TABLE_TYPE = ''''BASE TABLE'''' '' ' EXEC (@cmd) SELECT @id = 0 , @maxID = MAX(id) FROM #a WHILE @id < @maxID BEGIN SELECT @id = MIN(id) FROM #a WHERE id > @id SELECT @TableName = TableName FROM #a WHERE id = @id SET @cmd = 'exec ' + @DBName + '..sp_executesql N''update #a set norows = (select rows from sysindexes where indid in (0,1) and id = object_id(''''' + @TableName + '''''))' SET @cmd = @cmd + ' where #a.id = ' + CONVERT(VARCHAR(10), @id) + '''' EXEC (@cmd) IF @rc <> 0 OR @@error <> 0 BEGIN RAISERROR('failed %s',16,-1,@TableName) RETURN END END SELECT * FROM #a ORDER BY norows desc DROP TABLE #a GOThe Output:
EXEC sp_GetRowsCountForAllTables
SELECT Title , COUNT(Title) AS NumOccurrences FROM dbo.Employees GROUP BY Title HAVING ( COUNT(Title) > 1 ) SELECT * FROM dbo.Employees