listView2.Items.Clear();
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\db1.mdb;Persist Security Info=True;Jet OLEDB:Database Password=1234567788");
con.Open();
string sql = "select roomno,flag from roominformation where floor = 'first';";
OleDbCommand com = new OleDbCommand(sql, con);
OleDbDataReader dr = com.ExecuteReader();
while (dr.Read())
{
ListViewItem b = new ListViewItem();
b.Text = dr.GetString(0);
listView2.Items.Add(b.ToString(), 0);
}
i am using above code to show items in the list view and also image on index zero from image list.. this code is working fine but it adds some extra letters to result.. for ex.. it should result like 1002.. but it is showing like ListViewItem : {1002} this. it is working correctly when i use code like this listView2.Items.Add(b); but when i adds .ToString() to this then the problem starts becoz without using .ToString() it doesnt accept image index.... show me the correct way so that i remove extra text from the result..