TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
sujay anand
NA
107
30.2k
ASp.Net Timer
Sep 5 2014 9:04 AM
As I m using MKB timer Control. In my project I want insert intime and outime and calculate the difference. Intime is inserting but there is problem in inserting outime. Can u find this error and correct it?
protected void Button1_Click(object sender, EventArgs e)
{
DateTime time = DateTime.Parse(string.Format("{0}:{1}:{2} {3}", TimeSelector1.Hour, TimeSelector1.Minute, TimeSelector1.Second, TimeSelector1.AmPm));
var shortDate = time.Date;
ClientScript.RegisterStartupScript(this.GetType(), "time", "alert('Selected Time: " + time.ToString("hh:mm:ss tt") + "');", true);
SqlConnection conn = new SqlConnection(@"Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=SUJAY;Data Source=SUPREME6-PC");
conn.Open();
String s = "Insert into timesheet(username,intime) values('" + Label1.Text + "','" + time + "')";
//String s = "Insert into timecal(starttime) values('" + time + "')";
SqlCommand cmd = new SqlCommand(s, conn);
cmd.ExecuteNonQuery();
conn.Close();
}
protected void Button2_Click(object sender, EventArgs e)
{
DateTime time = DateTime.Parse(string.Format("{0}:{1}:{2} {3}", TimeSelector1.Hour, TimeSelector1.Minute, TimeSelector1.Second, TimeSelector1.AmPm));
var shortDate = time.Date;
ClientScript.RegisterStartupScript(this.GetType(), "time", "alert('Selected Time: " + time.ToString("hh:mm:ss tt") + "');", true);
SqlConnection conn = new SqlConnection(@"Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=SUJAY;Data Source=SUPREME6-PC");
conn.Open();
String s = "Update timesheet(outime) values('" + time + "') where outime= ISNULL";
//String s = "Insert into timesheet(outime) values('" + time + "')";
SqlCommand cmd = new SqlCommand(s, conn);
cmd.ExecuteNonQuery();
conn.Close();
endTime = DateTime.Now;
}
Reply
Answers (
0
)
Password creation
How to create a different links of Registration in asp.net