Total Pageviews


How To : Publish Asp.Net website in local machine

In this tutorial I will explain how to publish website in local machine.First you will need to check IIS is installed on your local machine or not.Now open your application in visual studio we need to publish on local machine.
  •     Open the website goto “menu”, select “Build” and click on “Publish Web Site”.  

 Now open one wizard in that it will put target location i.e., the place to save the published application (ex: Create one folder on desktop or any other location give that path by using browse button beside of that textbox).

  • Now click on “OK” publish it all the files into target location.
  • Now go to the location folder copy that folder and put it in wwwroot folder(path of that folder is C:\Inetpub\wwwroot)

  • Now open the Run in Start Menu or keyboard shortcut (Window Key + R) and type inetmgr and Click Enter it will redirect to IIS

  • Open the Sites after that open the Default web site in that you will find your published website because you have already placed in wwwroot folder.

  •  Click on right side of your website it will display all of your published pages select whatever the page first you need to run right click on that and click browse it will display your published website.

Now your website is published on your local computer.


SQL Server : Copy table from one database to another database

Come across situation where I need to copy table from database “db2 “to database “db1”  with data, for that a very handy & useful query given below :-


             SELECT * INTO db1.dbo.table1
             FROM db2.dbo.table2

Please mind that this query only copies table schema and data only.

All constraints, indexes, statatics, you need to use alternatives

A next generation digital books by - Mike Matas

I enjoyed this TED Video of Mike Matas discussion regarding a next generation digital book for the iPad. Importance 4 minutes of your life if your interested in that sort of thing. Looks like from the end of the video the company Mike is working for (Push Pop Press) are developing an SDK to make it easier produce very media rich content.


Database BackUp and Restore Script

For .Net developer a very common task is to take reguler backup and restore of SQL Server Database. Most of the time developer does that thru UI of Sql Server Management Studio. It is acully nice to know the Scripts which we can run and take backup and restore easily.

       To BackUp :-        
     BACKUP DATABASE [DatabaseName] TO DISK = 'C:\FileName.bak' WITH FORMAT
       To Restore :-
           RESTORE DATABASE [DatabaseName] FROM DISK = 'C:\FileName.bak'

Also when ever you do any database opration thru UI of Sql Server Management Studio you can always have look to the Script behind that opration. Its good practise to look at the script run by Sql Server to do any database realted opration.


How to insert multiple records with single insert query

Today itself I encounter a situation where I need to insert multiple data rows with single SQL query.

    USE [Demo]
    --Create Demo Table—
    CREATE TABLE DemoTable(Data VARCHAR(50))       

    --The way we used to—

    INSERT INTO DemoTable(Data)
        VALUES ('DATA 1');
    INSERT INTO DemoTable(Data)
        VALUES ('DATA 2');
    INSERT INTO DemoTable(Data)
        VALUES ('DATA 3');
    INSERT INTO DemoTable(Data)
        VALUES ('DATA 4');
Solution 1:

    CREATE TABLE DemoTable(Data VARCHAR(50))       

    INSERT INTO DemoTable(data)
        VALUES ('DATA 1'),('DATA 2'),('DATA 3'),('DATA 4');

Solution 2:

    CREATE TABLE DemoTable(Data VARCHAR(50))       

    INSERT INTO DemoTable(data)

Twitter Delicious Facebook Digg Stumbleupon Favorites More

Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Affiliate Network Reviews