devxlogo

Tip Bank

SQL Server Database Restore Via Stored Procedure

The following stored procedure will restore the database. This is helpful when you need to restore the database from other applications: CREATE PROCEDURE [dbo].[sp_db_restore]@DBName varchar(60),@BackName varchar(120),@DataName varchar(60),@DataFileName varchar(120),@LogName varchar(60),@LogFileName varchar(120)

Constructors of Built-in Types

The way we have constructors for user defined data types, we also have constructors for built in data types like chat, int, float and so on. Here is a program

Manipulate Complex Numbers

The following demonstrates how to manipulate complex numbers: class Complex{ double real; double imag; Complex() { } Complex(double real,double imag) { this.real=real; this.imag=imag; } void addComplexNos(Complex comp1,Complex comp2) { this.real=comp1.real+comp2.real;

A Simple Way to Debug a Stored Procedure

Debugging stored procedures can be a headache, but heres an easier way to trace a stored procedure’s execution: Use the PRINT statement. PRINT lets you output and analyze variable values,

GetDriveLabel – Retrieving the label of the specified drive

‘ Retrieve the drive name (label) of the specified drive’ Note: requires a reference to the System.Management assembly’ Example: MessageBox.Show(GetDriveLabel(“D”c))Function GetDriveLabel(ByVal driveLetter As Char) As String Dim driveFilter As String

Clearing the Clipboard

VB6’s Clipboard object has methods such as GetData, GetText, SetData, and SetText, which allow the developer to store to and retrieve data from the clipboard. VB.NET’s System.Windows.Forms.Clipboard class also has