Search Results:

Friday, October 16, 2009

Easily Create Loading GIF's for free

Here is a website to create a Loading GIF and save it to your desktop very easily. Give it a try ?? Click Here

A few samples below are



Another one

Wednesday, October 14, 2009

Disable Autorun of CD's,Pendrives etc

Here is the registry edit that can be done to disable the auto run feature in windows.
  1. Go to RUN type "Regedit".
  2. Go to Hkey_current_user/Software/Microsoft/windows/currentversion/policies/Explorer
  3. Add DWORD "NoDriveTypeAutoRun
  4. Edit the Value to Hexadecimal "FF"
You are set now the auto run is disabled.

Tuesday, October 6, 2009

Query to find no of multiple columns

SELECT id, COUNT(id) AS NumOccurrences
FROM Driver_History
GROUP BY id
HAVING (COUNT(id) = 2)


This above query gives all the rows that have same id's.

Monday, September 28, 2009

Connection Strings Made easy .

Visit this website for various connection strings such as to connect to Access,Excel etc...

Click Here


Once you get the connection string it is similar to any other database access. use ole db connection objects.

Friday, September 25, 2009

Get Open Dialog to browse system files

The OpenFileDialog class is defined in Windows.Forms class. You need to add to reference to System.Windows.Form.dll library and call using System.Windows.Forms before using the class.

The OpenFileDialog class can be used to open a file similar to CFileDialog 's Open method in VC++. This class is derived from FileDialog. OpenFile method of this class opens a file which can be read by a steam.

In this sample code, I have use OpenFileDialog class to browse a file.

Private fdlg As OpenFileDialog = New OpenFileDialog()
Private fdlg.Title = "C# Corner Open File Dialog"
Private fdlg.InitialDirectory = "c:\"
Private fdlg.Filter = "All files (*.*)|*.*|All files (*.*)|*.*"
Private fdlg.FilterIndex = 2
Private fdlg.RestoreDirectory = True
If fdlg.ShowDialog() = DialogResult.OK Then
textBox1.Text = fdlg.FileName
End If

Title member let you set the title of the open dialog. Filter member let you set a filter for types of files to open.

Sunday, September 13, 2009

Delete Duplicate Rows in SQL Server.

Deleting duplicate rows in SQL Server

--1.Deleting rows from a table having primary key

CREATE TABLE TEST1
( ID INT NOT NULL PRIMARY KEY
,VALUE CHAR(2)
)

INSERT INTO dbo.TEST1 SELECT '1','A' UNION ALL SELECT '2','A' UNION ALL SELECT '3','A' UNION ALL SELECT '4','B' UNION ALL SELECT '5','B' UNION ALL SELECT '6','B'

The original table with duplicates

DELETE FROM dbo.TEST1 WHERE ID NOT IN (SELECT MIN(ID) FROM dbo.TEST1 GROUP BY VALUE)

Now the resulting table with no duplicate rows

2. Deleting rows from a table without a primary key

I have a table dbo.MYDATABASE with following data---


now deleting the duplicate rows using ROW_NUMBER()


WITH TEMP_TABLE AS ( SELECT ROW_NUMBER() OVER( PARTITION BY CUSTID ORDER BY CustID ) AS ROWNUMBER,* FROM dbo.MYDATABASE )

DELETE FROM TEMP_TABLE WHERE ROWNUMBER > 1


The result looks like

Thursday, September 10, 2009

Visual Studio Debug skips the break point

The main issue i found out is the problem with the browser. (IE8)
IE 8 has a feature called Loosely-Coupled Internet Explorer (LCIE) which results in IE running across multiple processes.
http://www.microsoft.com/windows/internet-explorer/beta/readiness/developers-existing.aspx#lcie

Older versions of the Visual Studio Debugger get confused by this and cannot figure out how to attach to the correct process. You can work around this by disabling the process growth feature of LCIE. Here's how:

1) Open RegEdit
2) Browse to HKEY_LOCALMACHINE -> SOFTWARE -> Microsoft -> Internet Explorer -> Main
3) Add a dword under this key called TabProcGrowth
4) Set TabProcGrowth to 0

Since you are running on Windows Server 2003, this is all you should need to do. If you run into the same problem on Vista or newer, you will also need to turn off protected mode.