Storing a image using

Leave a comment

Hi, Use this code to store an image in the online server.

Before doing that we must give Permisiions to the folder in which you want to store Images.

Give Read and Write Permissions.

You must use fileupload control to do this:

Here is the code:

string extn =    System.IO.Path.GetExtension(FileUpload1.FileName);

if ((extn == “.jpg”) || (extn == “.gif”) || (extn == “.png”) || (extn == “.jpeg”))
path = Server.MapPath(“~/Documents”) + “//” + FileUpload1.FileName;

string script = “alert(‘Document Uploaded Successfully…’);”;
Page.ClientScript.RegisterStartupScript(this.GetType(), “str”, script, true);

string script = “alert(‘Invalid File Format…’);”;
Page.ClientScript.RegisterStartupScript(this.GetType(), “str”, script, true);
Any doubts Mail Me at


Insert Null values into datetime column of SQL SERVER using,C#


Sometimes we will get the situation where we must insert NULL into datetime column in sql server.

Follow these steps to do that:

1) First Include the namespace:

using System.Data.SqlTypes;

2)  Declare

System.Data.SqlTypes.SqlDateTime getDate;
getDate = SqlDateTime.Null;

3) Insert using command Parameters

cmd11.Parameters.AddWithValue(“@encashed_date”, getDate);


%d bloggers like this: