Click here to Skip to main content
15,914,160 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Memeber,


How to Check Date Column in Sql Using C#.

then insert it to DataBase.

Kindly advise.
Posted

com.CommandText = "insert into Persons_info(perId, latinName, gender, dob, pob, phone, passport, curAdd, status) values (@perId, @latinName, @gender, @dob, @pob, @phone, @passport, @curAdd, @status)"

com.Parameters.Add(new SqlParameter("@perId", txtId.Text));
com.Parameters.Add(new SqlParameter("@latinName", txtLatinName.Text));
com.Parameters.Add(new SqlParameter("@gender", cbGender.Text));
com.Parameters.Add(new SqlParameter("@dob", dTPdob.Text));
com.Parameters.Add(new SqlParameter("@pob", txtPob.Text));
com.Parameters.Add(new SqlParameter("@phone", txtPhone.Text));
com.Parameters.Add(new SqlParameter("@passport", txtPassport.Text));
com.Parameters.Add(new SqlParameter("@curAdd", txtCurAdd.Text));
com.Parameters.Add(new SqlParameter("@status", cbStatus.Text));
 
Share this answer
 
Comments
Member 10532715 24-Jul-14 3:34am    
This is my Coding. I need Varify date Before Insert to Database. only one column is variyfing Date Column Is my label2.text column it is not Varfy the date to Sql Server date.

SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ReliableAttandance"].ConnectionString);


string CheckString = "SELECT COUNT(*) FROM attandence where StaffName='" + DropDownList1.SelectedItem.Text + " AND Dutydate = " + Label2.Text + "'";


SqlCommand commandCheck = new SqlCommand(CheckString, conn);

conn.Open();

int Count = (int)commandCheck.ExecuteScalar();

if (Count > 0)
{
Label4.Text = "Already exists";
}
else
{
What Kind of Validation u need for Date while inserting it to Database ??
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900