I am working on a project where I have check box list and a datagridview. I populate datagridview from database. Now, what I need is to populate datagridview from database depending on checked items in check box list.
I am working in VS 2010, sqlCEserver, .net 3.5
I was wondering is there a way to do this:
SELECT * FROM articles WHERE name LIKE
I think this will solve my problem.
Please help.

Iftikar HussainRank #423 · 5.9K reputationPosted Jul 30, 2013, 3:58 AM EDT
Are you looking for in ASP.NET or Windows Form?
Regards,
Iftikar
Konstantin Pankarican18 reputationPosted Jul 30, 2013, 4:04 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 30, 2013, 4:05 AM EDT
Regards,
Iftikar
Konstantin Pankarican18 reputationPosted Jul 30, 2013, 4:09 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 30, 2013, 4:32 AM EDT
Regards,
Iftikar
Konstantin Pankarican18 reputationPosted Jul 30, 2013, 4:35 AM EDT
Rosi Sreenivasa Reddy137 reputationPosted Jul 30, 2013, 4:37 AM EDT
if you r interested i think by using subquery
select * from articles where name=(select name from articles where checked='y')
i think it will execute can try it
if it is not possible we can go stored procedure?
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 30, 2013, 4:40 AM EDT
Regards,
Iftikar
Konstantin Pankarican18 reputationPosted Jul 30, 2013, 4:47 AM EDT
Konstantin Pankarican18 reputationPosted Jul 30, 2013, 1:19 PM EDT
excuse me it's my mistake. It's not checkedlistbox. It's listview with checkboxes enabled in properties. here's the code:
try
{
cn.Open();
SqlCeCommand cm = new SqlCeCommand("SELECT * FROM tbl_employees WHERE oblik='Pravno lice'", cn);
SqlCeDataReader dr = cm.ExecuteReader();
while (dr.Read())
{
ListViewItem item = new ListViewItem(dr["sifra"].ToString());
item.SubItems.Add(dr["ime"].ToString());
listView1.Items.Add(item);
}
}
catch (SqlCeException ex)
{
MessageBox.Show(ex.Message, "Error");
Application.ExitThread();
}
Once again, I'm sorry for mistake.
Regards.
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 30, 2013, 8:48 PM EDT
ListViewItem item = new ListViewItem(dr["sifra"].ToString());
item.SubItems.Add(dr["ime"].ToString());
Regards,
Iftikar
Rosi Sreenivasa Reddy137 reputationPosted Jul 30, 2013, 8:59 PM EDT
can you explain clearly for me also.what to do and how the flow was going on,
In both front End and Back End.
by using asp.net web Application 3.5 and Sql Server 2008 r2
Konstantin Pankarican18 reputationPosted Jul 30, 2013, 10:25 PM EDT