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
Sk Jha
NA
113
43.4k
date wise filter record in gridview in asp.net
Jan 13 2018 9:35 PM
My code is not working for date wise filter record and bind to gridview. giving error
Conversion failed when converting date and/or time from character string.
my code is
protected
void
btnShow_Click(
object
sender, EventArgs e)
{
try
{
SqlCommand cmd =
new
SqlCommand(
"select * from OrraStock_Sales where createDate between '@fromDt' and '@toDt'"
, con);
cmd.Parameters.AddWithValue(
"@fromDt"
,txtFromDt.Text);
cmd.Parameters.AddWithValue(
"@toDt"
,DateTime.Parse(txtToDt.Text));
con.Open();
SqlDataAdapter da =
new
SqlDataAdapter(cmd);
ds =
new
DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
lblTotRecord.Text =
""
+ ds.Tables[0].Rows.Count;
con.Close();
}
catch
(Exception ex)
{ Response.Write(ex.Message); }
}
Please help me.
Reply
Answers (
1
)
when call db.SaveChanges() Appear this Exception
how to check already existing record in mvc