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.
Konstantin PankaricanPosted Jul 31, 2013, 2:25 AM
Rosi Sreenivasa ReddyPosted Jul 31, 2013, 12:59 AM
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
Iftikar HussainPosted Jul 31, 2013, 12:48 AM
ListViewItem item = new ListViewItem(dr["sifra"].ToString());
item.SubItems.Add(dr["ime"].ToString());
Regards,
Iftikar
Konstantin PankaricanPosted Jul 30, 2013, 5:19 PM
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.
Konstantin PankaricanPosted Jul 30, 2013, 8:47 AM
Iftikar HussainPosted Jul 30, 2013, 8:40 AM
Regards,
Iftikar
Rosi Sreenivasa ReddyPosted Jul 30, 2013, 8:37 AM
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?
Konstantin PankaricanPosted Jul 30, 2013, 8:35 AM
Iftikar HussainPosted Jul 30, 2013, 8:32 AM
Regards,
Iftikar
Konstantin PankaricanPosted Jul 30, 2013, 8:09 AM
Iftikar HussainPosted Jul 30, 2013, 8:05 AM
Regards,
Iftikar
Konstantin PankaricanPosted Jul 30, 2013, 8:04 AM
Iftikar HussainPosted Jul 30, 2013, 7:58 AM
Are you looking for in ASP.NET or Windows Form?
Regards,
Iftikar