my question is related to visual C#. i am retreiveing data in list view using following code:
try
{
listView1.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=123456789");
con.Open();
string sql = "select name from record where surname= 'sharma'";
OleDbCommand com = new OleDbCommand(sql, con);
OleDbDataReader dr = com.ExecuteReader();
while (dr.Read())
{
ListViewItem b = new ListViewItem();
b.Text = dr1.GetString(0);
listView1.Items.Add(b,0);
listView1.Refresh();
}
con.Close();
}
catch (Exception ex)
{
MessageBox.Show("" + ex);
}
but i also want to show image with each record from image list from index 0.. i dont know how to do that...... i am giving imge index at where i background with yellow color.but it is giving error...Error 1 The best overloaded method match for 'System.Windows.Forms.ListView.ListViewItemCollection.Add(string, int)' has some invalid arguments
Error 2 Argument '1': cannot convert from 'System.Windows.Forms.ListViewItem' to 'string'