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
shobitha babu
NA
3
0
addition of dates in database
Jan 23 2009 12:42 AM
hii.....am a beginner in c#.....
am havin a database to store set of dates n t dates should be distinct. i hav not given t date column has primary key.. codin tat i hav given below doesnt work properly....
can any one tell me wts wrong in it n how to add distinct dates
protected void Calendar1_SelectionChanged1(object sender, EventArgs e)
{
dap = new OleDbDataAdapter("select cdate from calen", con);
dap.Fill(ds1);
lbldate.Text = Calendar1.SelectedDate.ToShortDateString();
for (int i = 0; i <= (ds1.Tables[0].Rows.Count -1); i++)
{
if (ds1.Tables[0].Rows[i][0].ToString() == lbldate.Text)
{
lbldate.Text = "date already exists";
}
else
{
OleDbCommand com = new OleDbCommand();
com.CommandText = "insert into calen values('" + lbldate.Text + "')";
com.Connection = con;
com.ExecuteNonQuery();
break;
}
}
}
Reply
Answers (
2
)
Unable to render Linkbutton control
How to avoid this problem in ASP.NET, AJAX