Help full SQL queries

f--* Show information about Database
--* Syntax > sp_helpdb [databasename]
--* Eg : for pubs
sp_helpdb pubs

Continued...

How to create a personal blog?

Blog Starter Kit
Introduction

You are just a few steps away from starting to publish posts on your Blog site. The following sections explain how to customize and use the Blog Web Site.

  • Creating an Administrative User
  • Customizing the Blog
  • Administering the Blog 
  • Further Resources

Creating an Administrative User
The first step you must take is to create an administrative user. The administrative user has permission to post articles, moderate feedback, and manage categories.

To create an administrative user

Continued...

How to generate html page from MS SQL with a template page.

sp_makewebtask

Creates a task that produces an HTML document containing data returned by executed queries.

Other Sp's are

sp_runwebtask

sp_enumcodepages

sp_dropwebtask

Note  All Web jobs are categorized as Web Assistant in the Job Categories dialog box in SQL Server Enterprise Manager. For more information.

Syntax

Continued...

use of WAITFOR in MS SQL 2000 for T-SQL

WAITFOR

Specifies a time, time interval, or event that triggers the execution of a statement block, stored procedure, or transaction.

Syntax

WAITFOR { DELAY 'time' | TIME 'time' }

Arguments

DELAY

Instructs Microsoft® SQL Server™ to wait until the specified amount of time has passed, up to a maximum of 24 hours.

'time'

Continued...

How to use a control to send its HTML as and Email

Many a time we want to send Email, which resembles the output of a web control. At these occasions it would be great to be able to send the output of a web control.

For this article I am assuming that the SMPT server is configured. We can capture the output of most of the control using their Render Control method. After that you can send the output of the control through a mail.
Here is the code for

Continued...

AppendDataBound Items lets you add static data to dynamically populated list

There are quite a few features in ASP.NET 2.0. One of new healthy features in list controls (CheckBoxList, ListBox, DropdownList etc...) is the new property "AppendDataBoundItems" You can bind the list controls to some data source and also add some static data.

If the "AppendDataBoundItems" property is set to true then you will get all the date (static data and data populated by data source) in the list. This is very handy if you want to add a "Select One" item in the Dropdownlist and listbox.

The full Syntax is

Continued...

How to represent a quote within a string in C#

\n = New Line
\r = Carriage return
\r\n = Carriage return and New line
\” = Quotation mark
\\ = Backlash character
\t = Tab

[Note: Even though escaped characters involve two characters (backslash \ plus the escaped character) the compiler treats the sequence as one character. That means that \n is a single character and the same is true for \", \\, etc]


Thanks Vikram


Events fired during the Life Cycle of the of a page in Asp.Net 2.0
It talked about the entire event that takes place when a request is made. You can read the article here. This Article talk about the event that takes place in the Page.

PreInit()
In this event all the page level controls are created. The property assigned in the HTML is also assigned to the controls in this event. This event is only there for page and not present in user control (Hence not present in Master Page also). If we want to change the Theme and master page of a page, we need to override this event.
[Note: When you override this event remember to call the base pages preInit command.]

There is a big difference in the event when we have a master page for the page. If there is a Master page associated with the page then the controls on the page are not initialized. In this case the controls will be initialized only after the Init event. As I said earlier that master page does not have any
Continued...

Theme changing on the fly using ASP.Net 2.0

How users can change the look and feel of the site?

User can change the full theme (images, skin, and css) will change. This can be done very easily in asp.net 2.0.

All my pages are inheriting from basewebpage which inherits from System.Web.UI.Page. In basewebPage I overrode the StyleSheetTheme method like this.

public override string StyleSheetTheme
    {
        get{ return HttpContext.Current.Profile["StylesheetTheme"].ToString();}
        set{ HttpContext.Current.Profile["StylesheetTheme"] = value; }
    }

Continued...

How to do sorting and paging on Gridview w/o a DataSourceControl DataSource
If you set AllowPaging="true" or AllowSorting="true" on a GridView control without using a DataSourceControl DataSource (i.e. SqlDataSource, ObjectDataSource), you will run into the following errors:

When changing the page on the GridView control:

The GridView 'GridViewID' fired event PageIndexChanging which wasn't handled.

When clicking a column name to sort the column on the GridView control:

The GridView 'GridViewID' fired event Sorting which wasn't handled.

As a result of not setting the DataSourceID property of the GridView to a DataSourceControl DataSource, you have to add event handlers for sorting and paging.


<asp: Continued...

How to make scroable div, how to maintain its position on postback
My friend was working on a page, which had a scrollable div. The problem was that after the post back the div would loose its scroll position. Now when there is a lot of data it is very inconvenient for the user to again scroll back to the position where he was before the post back.

The solution was quite simple. We saved the value of the scroll in a hidden variable. This was done on the onscroll event of the div. On the page load event of the page we again set the scroll of the div to the value saved in the hidden variable. That’s all. Here is a simple code to show the actual working.

Continued...

database data retrival

Situation: U have only a backup file of a database abcdatabase with extension of .bak (abcdatabase.bak), and u want to create a database called abcdatabase with the data with are in bak files.


Things to remember :
Database Name : abcdatabase
Backupfile Name : abcdatabase.bak
SQL SERVER NAME: your system name is it is local (EG: PRINCEPY)

Continued...

Javascript expression valication's

When it comes to password validation using regular expressions, things can get a bit complicated. Normally, you want people to enter a "good" password that has a mix of numbers and letters. But you may not care where the numbers and letters appear. So you're not looking for a "pattern" in the string. You just want a letter somewhere and a number somewhere.

In this first example, the password must be at least 8 characters long and start and end with a letter.

var re = /^[A-Za-z]\w{6,}[A-Za-z]$/;
if (!re.test(myString)) { alert("Please enter a valid password!"); }

Continued...

The new Microsoft IDE in VS.NET 2005 includes the ability to define custom tools to be accessible in the Main Tools Menu.

Follow these steps:

1.  Click Tools Menu (in VS.NET 2005 IDE)
2.  Click External Tools
3.  Define name for menu item in the Title text box
4.  Define full path and name of executable in the Command text box
5.  Define parameters to pass in the Arguments text box

Continued...

Note: DTS has been replaced by SQL Server Integration Services (SSIS) in SQL Server 2005. To learn about SSIS, read An Introduction to SQL Server 2005 Integration Services  on Microsoft TechNet.

Summary: Database administrators often import, export, and transform data in support of tasks such as data consolidation, archiving, and analysis; for application development purposes; and for database or server upgrades. Data Transformation Services (DTS) in SQL Server 2000 provides a set of graphical tools and programmable objects to help administrators and developers solve data movement problems, including the extraction, transformation, and consolidation of data from disparate sources to single or multiple destinations. Sets of tasks,
Continued...

Do the follwing steps to Import/Export data with SQL Server 2005 Express

1. Download MSXML 6.0 from Microsoft.com and run the setup.

2. Now Download Microsoft SQL Server Management Studio Express for connecting SQL Server 2005

http://www.microsoft.com/downloads/details.aspx?FamilyId=C243A5AE-4BD1-4E3D-94B8-5A0F62BF7796&amp;DisplayLang=en

and run the setup. (From here you can connect with SQL Server 2005 database.)

3. Now run DTSWizard.exe from C:\Program Files\Microsoft SQL Server\90\DTS\Binn\DTSWizard.exe

(Note: If you don't have "DTS"(Data Transformation Services) folder then check out the bottom link Or Post Named "DTS")

Continued...

To import your SQL 2000 database into a SQL 2005 database, you can use Microsoft’s SQL Server Management Studio. After you have installed and setup the software, follow the directions below:

Continued...

The article provides details on how to download and install SQL Express 2005 on your Computer.

There are 3 individual downloads that are required for SQL Express 2005 and have to be installed in the following sequence.

A. Microsoft .NET Framework Version 2.0 Redistributable Package Release Candidate (x86)
B. Microsoft SQL Server 2005 Express edition
C. Microsoft SQL Server Management Studio Express

Requirement: Windows 2003 Server for A, B & C
Requirement: Windows XP for A & C

Installing .NET 2.0

Continued...

You can easily create a HtmlMeta object and add it to the Controls collection in the HtmlHead class exposed via Page.Header. Here's a few samples:

// Render: <meta name="keywords" content="Some words listed here" />
HtmlMeta meta = new HtmlMeta();
meta.Name = "keywords" ;
meta.Content = "Some words listed here" ;
this .Header.Controls.Add(meta);

// Render: <meta name="robots" content="noindex" />
meta = new HtmlMeta();
meta.Name = "robots" ;
meta.Content = "noindex" ;
this .Header.Controls.Add(meta);

// Render: <meta name="date" content="2006-03-25"
Continued...

How to solve the problem of dot.net framework conflict?

When u get a error messaage like

"Unable to start debugging on the web server. The web server is not configured correctly. See help for common configuration errors. Running the web page outside of the debugger may provide further information.

if u installed diffrent verions of dot net framework like

  • Microsoft Visual Studio .NET 2003
  • Microsoft Visual Web Developer 2005 Express Edition
  • etc

their will be a change of getting this error since the debugger is getting confussed with all these framework.

to solve that we have to tell IIS to which framework it has to communicate.

for that u have to take a command prompt and try to reach till

"C:\WINDOWS\Microsoft.NET\Framework\"

and further try to reach the required framework folder

Continued...

Description:
This script uses DHTML or Popup windows to display a calendar for the user to select a date. It was designed to look and behave like Microsoft Outlook.
It can be implemented in only a few lines of code, yet also provides customization options to make it work correctly in any country's display format, etc.
Note: Why are form elements or <SELECT> boxes showing over top of the DIV-style calendar popup? It's not a bug in the javascript - it's a bug/feature of browsers. See this explanation by WebReference.

Example:
Below are multiple examples of the CalendarPopup in use. Each is slightly different to show different capabilities of the script.
Click the "Show Source" links for each example to see how it was done, and hover over the "Select" links to see how they are coded. Or view the source of the entire page!

Continued...

Microsoft's Silverlight

Microsoft’s latest gift in the name of Silverlight, is all set to replace the old and traditional Adobe's Flash and become the technology of choice for developing the next generation of cross-browser, cross-platform Rich Internet Applications (RIAs). Moreover, Microsoft has already decided to make this plug-in freely available for all supported platforms. This article presents an introduction to this technology, its applicability, and its future; it also provides links and references for further insight onto this technology.

What is Silverlight and why is it useful?

Continued...

looks crazy if u saw this then u saw this error "Cannot use parentheses when calling a Sub" in javascript.

When i was doing programs i neet to write a function which will take 2 arrgument(lets say id's of 2 html tags) into an javascript, so that i can play with the property of those tags on client side.

my function was

function _OnClickButton(UserNameTextBoxID, PasswordTextBoxID)
{
.....
......
}

OnServerSide

i wrote as

Continued...

Codes to help to connect VS 2005 to SQL Express manualy

After install Visual Studio 2005, you must install “SQL Server Management Studio Express CTP”. This program plugs into SQL Express 2005. Run SQL Server Management Studio Express CTP and press connect to connect into Server Management Studio Express.

After connect, you must make a new database and a new table, for example: make database and give a name for a new database “Practice_1”. Then, make one table which consist of field “No” and field “Name” and give name for a new table “Checklist”.

After finish making your table, please input same data into your table. Now run your Visual Studio 2005 and make new application windows.  Drag dataGridView into your design form and choose dock in properties become fill. Double click your form and insert these codes:

Continued...

this contains the links for usefull site links from which u can download icons free..

windows icons: 

Continued...

The "Microsoft.Web.Extensions" is not used anymore. Once you installed AJAX RC1 it will use new dll called "System.Web.Extensions"

It located in C:\Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025\System.Web.Extensions.dll

If you open project with previous AJAX version, you will have to replace old script manager with new one.

To get ASP.NET 2.0 AJAX Extensions, Click Here

Copyright © 2007- 2008   Prince P.Y