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
Mfwamba Tshimanga
NA
155
46.5k
Multiples filters: should be wront codes. Which solution?
Jan 23 2015 11:34 AM
Hi!
I would like to filter dates with two values once (dates + days + name).
But I receive this error message: "not sufficient parameters..."
conn.Open();
OleDbCommand cmd = conn.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select * from personal where (date between ? and ?) and days = ? and (name = ?)";
var param1 = new OleDbParameter("@StartDate", OleDbType.Date);
var param2 = new OleDbParameter("@EndDate", OleDbType.Date);
var param3 = new OleDbParameter("@name", OleDbType.VarChar);
var param4 = new OleDbParameter("@days", OleDbType.VarChar);
param1.Value = dataStart.Value.Date;
param2.Value = dataFinal.Value.Date;
param3.Value = days.Text;
param4.Value = name.Text;
if (dataStart.Value <= dataFinal.Value)
{
cmd.Parameters.Add(param1);
cmd.Parameters.Add(param2);
}
else
{
cmd.Parameters.Add(param2);
cmd.Parameters.Add(param1);
}
cmd.Parameters.Add(param3);
cmd.ExecuteNonQuery();
DataTable dt = new DataTable();
OleDbDataAdapter da = new OleDbDataAdapter(cmd);
da.Fill(dt);
conn.Close();
dgvRpt2.DataSource = dt;
}
Reply
Answers (
5
)
Error in Retrieving Binary Image using generic Handler
Can I create my own report?