Reset Identity Column in SQL Server   Leave a comment

Today, I was in need for resetting my Identity Column in SQL server. Because I was testing the system and once done, I deleted all the data. So, now it was a need to resetting the Identity column so that it will start seeding from the 0 once again.

This will be the older concept for the veteran but would like to note it down here for new developers. Run Following SQL Query in your Query Window and Execute it. This will reset the identity column’s value once gain to 0, so that the newt record will start from 1.

DBCC CHECKIDENT(‘Employees’, RESEED, 0)

Here ‘Employees’ Is the name of the Table. This will reset the Identity column’s value to 0. So, next record will start from 1.

Enjoy!!!

Posted February 15, 2011 by kinjanshah in ASP.NET, Database, Identity Column, SQL Server 2005

Save Dialog Box   Leave a comment

Hello Folks,

Today we will learn about the most widely used things in any web application i.e. Open/Save/Cancel Dialog Box. You may have come across such situation in which you need to show the uploaded file/software to the end user. Sometimes it is very common that you need to allow the users to download the files or software. So, in that case you can use following piece of code.

Dim filePath As String = “C:\Downloads\File.xls” ‘This is the Path for the File to be downloaded

Dim targetFile As System.IO.FileInfo = New System.IO.FileInfo(filePath)

 

If targetFile.Exists Then

Response.Clear()

Response.AppendHeader(“Content-Disposition”, “attachment; filename=” + targetFile.Name)

Response.AddHeader(“Content-Length”, targetFile.Length.ToString)

Response.ContentType = “application/octet-stream”

Response.TransmitFile(targetFile.FullName)

End If

Once you write this code, User will be asked to either Save/Open or Cancel the File for either download or open.

Posted February 15, 2011 by kinjanshah in ASP.NET, File Namespace, Save Dialogbox

Password Encryption   Leave a comment

In This Post, I will explain you how to Encrypt the User Password with the Inbuilt Algorithm called MD5 in ASP.NET

Following Code will use “User Password” and it will encrypt it with the help of MD5 Algorithm. And then we can store it in the database

Imports System.Security.Cryptography

Dim md5Hasher As New MD5CryptoServiceProvider()

Dim hashedBytes As Byte()

Dim encoder As New UTF8Encoding()

Dim Password As String = “UserPassword”

hashedBytes = md5Hasher.ComputeHash(encoder.GetBytes(Password))

Here hashedbytes is the encrypted Password and now we can store it into the database.

So, thus we can encrypt the password. So, instead of storing the password directly into the databse, we can store the encrypted password, in order to provide the security to the Client.

Posted January 28, 2011 by kinjanshah in ASP.NET, Database, MD5 Encryption Algorithm, Security

Welcome to Technical School!!!!   Leave a comment


To,

All Veteran Techies & Wanna Be Techies,

I am Kinjan Shah (Founder and Owner of iMaze Technology).

I’ve done  my Bachelors of Engineering in Information Technology and having approx. 6 Years of Technical Experience in various technologies.

Along with that I pertain MCP, MCAD and OCA Certificates which again Proves it.

My Mission behind this blog is to make Technies aware about the things in various technologies and to teach them what I know in various technologies.

 

I will post the technical things almost daily in this blog, again in various technologies.

So, lets not waste the time in introduction and lets get started.

 

Posted September 21, 2008 by kinjanshah in ASP.NET, Technologies