Posts

Showing posts from 2016

Take Backup of SQL Database Using Batch file

Step for Take Backup 1.Open Notepad 2.Paste following Code in notepad 3.Save this file as backup.bat Code snippets echo off cls echo -- BACKUP DATABASE -- set DATABASENAME=MobileRecharge :: filename format Name-Date (eg MyDatabase-2009.5.19.bak) set DATESTAMP=%DATE:~-4%.%DATE:~7,2%.%DATE:~4,2% set BACKUPFILENAME=D:\%DATABASENAME%-%DATESTAMP%.bak set SERVERNAME=DESKTOP-0BOTN0I\SQLEXPRESS echo. sqlcmd -E -S %SERVERNAME% -d master -Q "BACKUP DATABASE [%DATABASENAME%] TO DISK = N'%BACKUPFILENAME%' WITH INIT , NOUNLOAD , NAME = N'%DATABASENAME% backup', NOSKIP , STATS = 10, NOFORMAT" echo. pause Instruction 1. MobileRecharge is database name replace this name with your database which you want to take backup 2. Here we specify D:/ for take backup 3.DESKTOP-0BOTN0I\SQLEXPRESS is server name replace with your server name 4.Run the file and see the backup in D:/ Drive 5.If you want to take backup Automatically Schedule this file in Task Scheduler...

How to create bootable pendrive using cmd

Run command prompt with admin rights and take following step Insert a USB flash drive into a running computer. Open a Command Prompt window as an administrator . Type diskpart. In the new command line window that opens, to determine the USB flash drive number or drive letter, at the command prompt, type list disk , and then click ENTER. The list disk command displays all the disks on the computer. Note the drive number or drive letter of the USB flash drive. At the command prompt, type select disk , where X is the drive number or drive letter of the USB flash drive, and then click ENTER. Type clean , and the click ENTER. This command deletes all data from the USB flash drive. To create a new primary partition on the USB flash drive, type create part pri , and then click ENTER. To select the partition that you just created, type select part 1 , and then click ENTER. To format the partition, type format fs=ntfs quick, and then click ENTER. Type active , and the...

Generate HTML Document from Code Behind Using .Net C#

using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string Name = "Alpesh D.Maniya"; StringBuilder sb = new StringBuilder(); sb.Append("<html><head><meta charset='utf-8'/><style>ul li{list-style:none;margin-top:3px;margin-bottom:3px;}h1{font-size: 23px;margin-bottom: 0px;margin-top: 0px;font-weight: normal;font-family: Arial;}h2{margin: 3px;margin-left: 0px;font-size: 16px;}h3{margin: 3px;font-size: 16px;}h4{margin: 3px;margin-left: 0px;font-size: 13px;}h5{margin: 3px;font-size: 11px;font-weight: normal;font-family: Arial;}</style></head>"); sb.Append("<body style='text-align: center;margin:auto;margin-top:0px;margin-bottom:5px;'>...

Get System Information and Send it in Email using C# .Net

Step for programme : 1.Read "systeminfo" command 2.Write it to string 3.Send Email Sample Code : using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Net.Mail; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Windows.Forms; namespace GetSystemInfo { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { System.Diagnostics.Process process = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; // the cmd program startInfo.FileName = "cmd.exe"; // set my arguments. dat...