Posts

Insert Null Value in DateTime Column SqlServer 2005 using asp.net

steps: 1) Create Simple web application (asp.net with C#). 2) create below table in the database. here i made table (table_1 in test database). DataBase Name :Test Table Name : Table_1 ColumnName ColumnDataType id int (Auto Increment & Primary Key) code varchar(50) (Allow Null True) date datetime (Allow Null True) 3) put the below control on the form. 3.1) Calendar (id --> Calendar1) 3.2) Button (id --> btnInsert) 3.3) Button (id --> btnGet) 3.4) Label (id --> lblDataValue) 4) put the below code in to C# page. Add below name space first : using System.Data.SqlClient; copy the below code and check. //connection string //please change as per your server and database string constr = @"Data Source=(local);Initial Catalog=test;Integrated Security=True"; public int insertedId { get { return Convert.ToInt32(ViewState["inserttedid"]); } set { ViewState["ins
Recent posts