Wednesday, April 3, 2013

Another version of Microsoft Visual Studio 2008 has been detected on this system that must be updated to SP1.

Go to the following registry entry:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DevDiv\VS\Servicing\9.0

Set "SP" value to "1"
Set "SPIndex" value to "1"



HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DevDiv\VS\Servicing\9.0\RED\1033


Set "SP" value to "1"
Set "SPIndex" value to "1"

Set "SPName" value to "SP1"

Wednesday, July 18, 2012

Sunday, June 3, 2012

Backup all Databases


DECLARE @DBName varchar(255)

DECLARE @DATABASES_Fetch int

DECLARE DATABASES_CURSOR CURSOR FOR
    select
        DATABASE_NAME   = db_name(s_mf.database_id)
    from
        sys.master_files s_mf
    where
       -- ONLINE
        s_mf.state = 0 

       -- Only look at databases to which we have access
    and has_dbaccess(db_name(s_mf.database_id)) = 1 

        -- Not master, tempdb or model
    and db_name(s_mf.database_id) not in ('Master','tempdb','model')
    group by s_mf.database_id
    order by 1

OPEN DATABASES_CURSOR

FETCH NEXT FROM DATABASES_CURSOR INTO @DBName

WHILE @@FETCH_STATUS = 0
BEGIN
    declare @DBFileName varchar(256)    
    set @DBFileName = datename(dw, getdate()) + ' - ' + 
                       replace(replace(@DBName,':','_'),'\','_')

    exec ('BACKUP DATABASE [' + @DBName + 'TO  DISK = N''c:\db backup\' + 
        @DBFileName + ''' WITH NOFORMAT, INIT,  NAME = N''' + 
        @DBName + '-Full Database Backup'', SKIP, NOREWIND, NOUNLOAD,  STATS = 100')

    FETCH NEXT FROM DATABASES_CURSOR INTO @DBName
END

CLOSE DATABASES_CURSOR
DEALLOCATE DATABASES_CURSOR

Sunday, May 20, 2012

GET /DevMgmt/DiscoveryTree.xml HTTP/1.1

GET /DevMgmt/DiscoveryTree.xml HTTP/1.1
Host: 127.0.02:8080

To remove above extra page after printing
follow these steps


Goto Printer Properties -> Device Settings
Open "Installable Options"
Disabled the "printer Status Notification"

Wednesday, April 18, 2012

Visual Studio toolbox items not showing


01 - Close Visual Studio
02 - Search *.tbd inside “C:\Documents and Settings\[UserName]\Local Settings\Application Data\Microsoft\VisualStudio” & delete them

Monday, March 19, 2012

Removing Smart Fortress


01 - Download
http://download.bleepingcomputer.com/reg/FixExe.reg
http://download.bleepingcomputer.com/grinler/iExplore.exe
and put these files in C:\ root folder



02 - Login in safe mode from your infected user.
Execute FixExe.reg from C:\
Execute iExplore.exe from C:\

Execute again FixExe.reg from C:\
Reboot in normal mode


03 - Download a good security program and clean up the mess, I am using Microsoft Security Essentials it is free and good.

Thursday, March 1, 2012

Sunday, January 29, 2012

Desktop IP for Windows CE or Windows Mobile when working without network

My Environment
OS: Windows 7
DB Server: SQL Server 2008 R2 (Default Instance)
Connectivity through: Windows Mobile Device Center
Application Developed in: Visual Studio 2008



For Windows CE
Desktop IP: 192.168.55.100
Device IP: 192.168.55.101

For Windows Mobile
Desktop IP: 169.254.2.2
Device IP: 169.254.2.1



Connection string inside my
Windows CE Project
"Data Source=192.168.55.100,1433;Initial Catalog=MyDB;Persist Security Info=True;User ID=sa;Password=MyPassword;"


Windows Mobile Project
"Data Source= 169.254.2.2,1433;Initial Catalog=MyDB;Persist Security Info=True;User ID=sa;Password=MyPassword;"

Tuesday, December 6, 2011

Folder Tree in Windows 7

01 - Press Alt in Windows Explorer to view menu bar (by default is not appearing)
02 - Inside Tools->Folder Options ...->General

        Navigation Pane        Check : Show All folders        Check : Automatically expand to current folder

Monday, December 5, 2011

Saving changes is not permitted - SQL Server


In MS SQL Server Management Studio


Tools
Options
Designers
Table and Database Designers
Uncheck -> Prevent saving changes ...

Difference between Debug & Release


The major difference between debug & release build is, Debug builds disable JIT optimization which can have a significant impact on performance,
In a debug build the complete symbolic debug information is emitted to help while debugging applications and also the code optimization is not taken into account. 


While in release build the symbolic debug info is not emitted and the code execution is optimized.
Also, because the symbolic info is not emitted in a release build, the size of the final executable is lesser than a debug executable.


In terms of execution speed, a release executable will execute faster for sure, but not always will this different be significant.


Most people ship release builds since they're faster.

Wednesday, November 23, 2011

Numeric Textbox allows only single .

Numeric Textbox
Allows digits only, only single ., limited decimal places

Private Sub txtnProQty_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtnProQty.KeyPress, txtnumProAmount.KeyPress, txtnumProCurRate.KeyPress, txtnSerQty.KeyPress, txtnumSerAmount.KeyPress, txtnumSerCurRate.KeyPress
Dim nKey As Integer = Asc(e.KeyChar)
Dim tBox As TextBox = CType(sender, TextBox)
Dim nMaxDecPlaces As Integer = 3
If nKey = 8 Then 'Backspace
e.Handled = False
ElseIf (nKey >= 48 And nKey <= 57) Or nKey = 46 Then
If nKey = 46 AndAlso tBox.Text.Contains(".") Then
e.Handled = True
Else
If (tBox.Text.IndexOf(".") > -1) And ((tBox.Text.Length - 1) - tBox.Text.IndexOf(".")) = nMaxDecPlaces Then
e.Handled = True
Else
e.Handled = False
End If
End If
Else
e.Handled = True
End If
End Sub

Private Sub txtnProQty_KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtnProQty.KeyUp, txtnumProAmount.KeyUp, txtnumProCurRate.KeyUp, txtnSerQty.KeyUp, txtnumSerAmount.KeyUp, txtnumSerCurRate.KeyUp
Dim tBox As TextBox = CType(sender, TextBox)
If tBox.Text = "" Then
tBox.Text = "0"
tBox.SelectAll()
End If
End Sub

Monday, April 4, 2011

SQL Server Data Types and Their .NET Framework Equivalents

SQL Server data type

CLR data type (SQL Server)

CLR data type (.NET Framework)

varbinary

SqlBytes, SqlBinary

Byte[]

binary

SqlBytes, SqlBinary

Byte[]

varbinary(1), binary(1)

SqlBytes, SqlBinary

byte, Byte[]

image

None

None

varchar

None

None

char

None

None

nvarchar(1), nchar(1)

SqlChars, SqlString

Char, String, Char[]

nvarchar

SqlChars, SqlStringSQLChars is a better match for data transfer and access, and SQLString is a better match for performing String operations.

String, Char[]

nchar

SqlChars, SqlString

String, Char[]

text

None

None

ntext

None

None

uniqueidentifier

SqlGuid

Guid

rowversion

None

Byte[]

bit

SqlBoolean

Boolean

tinyint

SqlByte

Byte

smallint

SqlInt16

Int16

int

SqlInt32

Int32

bigint

SqlInt64

Int64

smallmoney

SqlMoney

Decimal

money

SqlMoney

Decimal

numeric

SqlDecimal

Decimal

decimal

SqlDecimal

Decimal

real

SqlSingle

Single

float

SqlDouble

Double

smalldatetime

SqlDateTime

DateTime

datetime

SqlDateTime

DateTime

sql_variant

None

Object

User-defined type(UDT)

None

Same class that is bound to the user-defined type in the same assembly or a dependent assembly.

table

None

None

cursor

None

None

timestamp

None

None

xml

SqlXml

None

Tuesday, March 15, 2011

WPF Right-align GridViewColumn (For Arabic)

<listview.resources>

<datatemplate key="RightTemplate">

<textblock horizontalalignment="Right" textalignment="Right" text="{Binding Path=MyColumn}" />

</datatemplate>

</listview.resources>


<gridviewcolumn width="Auto" header="Grid Column Header" celltemplate="{StaticResource RightTemplate}" />

Wednesday, September 22, 2010

Rotate text in textboxes in rdlc reports

Set WritingMode to Vertical

WritingMode indicates whether the text is displayed horizontally or vertically.

it will make your text like this http://picskip.net/u/22094829.png

Tuesday, September 21, 2010

Report Parameters Missing in VS2010?

A. Open your report.
B. Click on the 'View' menu
C. Select 'Report Data'

Shortcut for this Ctrl+Alt+D

In VS2008 it was in Report's Property page as "ReportParameter"

Wednesday, June 16, 2010