Congratulations - C# Corner Q4, 2022 MVPs Announced
Why Join
Become a member
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
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forum guidelines
Mr. Thekotik
2.1k
32
2.3k
Multi-criteria search Functionality to your Access application ?#
May 27 2021 1:32 PM
Error:
System. ArgumentException: "This list cannot be cleared."
Code:
private
void
button3_Click(
object
sender, EventArgs e)
{
if
((textBox2.Text !=
""
) ||
(textBox3.Text !=
""
) ||
(textBox4.Text !=
""
) ||
(textBox5.Text !=
""
) ||
(textBox10.Text !=
""
) ||
(textBox8.Text !=
""
))
{
if
(radioButton1.Checked ==
false
& radioButton2.Checked ==
false
) { radioButton1.Checked =
true
; }
dataGridView1.Rows.Clear();
string
type =
""
;
string
name =
""
;
string
weight =
""
;
string
company =
""
;
string
client =
""
;
string
price =
""
;
string
log =
""
;
int
y = 0;
if
(radioButton2.Checked ==
true
) { log =
"OR "
; }
if
(radioButton1.Checked ==
true
) { log =
"AND "
; }
if
(textBox2.Text !=
""
)
{
type =
"??? = '"
+ textBox2.Text +
"'"
; y = 1;
}
if
(textBox3.Text !=
""
)
{
if
(y == 1) { name =
""
+ log +
"???????????? = '"
+ textBox4.Text +
"'"
; }
else
{ name =
"???????????? = '"
+ textBox4.Text +
"'"
; y = 1; }
}
if
(textBox3.Text !=
""
)
{
if
(y == 1) { weight =
""
+ log +
"??? = "
+ textBox4.Text +
""
; }
else
{ weight =
"??? = "
+ textBox4.Text +
""
; y = 1; }
}
if
(textBox5.Text !=
""
)
{
if
(y == 1) { company =
""
+ log +
"????? = '"
+ textBox5.Text +
"'"
; }
else
{ company =
"????? = '"
+ textBox5.Text +
"'"
; y = 1; }
}
if
(textBox10.Text !=
""
)
{
if
(y == 1) { client =
""
+ log +
"?????????? = '"
+ textBox10.Text +
"'"
; }
else
{ client =
"?????????? = '"
+ textBox10.Text +
"'"
; y = 1; }
}
if
(textBox8.Text !=
""
)
{
if
(y == 1) { price =
""
+ log +
"???? = "
+ textBox8.Text +
""
; }
else
{ price =
"???? = "
+ textBox8.Text +
""
; y = 1; }
}
string
query =
"SELECT ???, ????????????, ???, ?????, ??????????, ???? FROM ??????? WHERE "
+ type + name + weight + company + client + price +
""
;
Form2 form2 =
new
Form2();
OleDbCommand command =
new
OleDbCommand(query, form2.Connection);
OleDbDataReader reader = command.ExecuteReader();
while
(reader.Read())
{
dataGridView1.Rows.Add(
reader[0].ToString(),
reader[1].ToString(),
reader[2].ToString(),
reader[3].ToString(),
reader[4].ToString(),
reader[5].ToString());
}
reader.Close();
}
else
{
MessageBox.Show(
"?? ?????? ?? ?????!"
);
}
}
Reply
Answers (
1
)
sql identity num starts randomly
Narrator should reads status message after click on Add section button