Two tables in a single Listview

  • Thread starter Thread starter Can Arslan
  • Start date Start date
C

Can Arslan

Guest
i have 2 tables and i want to put all items in listview1. i will give my tables information.

RoomReg Table ---> ID, RoomNo , RoomDate , RoomOutDate , MusID1 , MusID2 , MusID3 .........................

( There are 3 customer ID of MusID1)

Cumtomer Table--->M_ID , Name , Surname , Birthday , Place ..................................

There are one Form1 to has 2 datetimepicker1 and datetimepicker2 and list button....................................

Selection two date and list Registration Rooms.

Listview items of Column Like That : (((Name , Surname , Birthday , Place , RoomNo , RoomDate , RoomOutDate)))

I Apply like this :


listView1.Items.Clear();
connect();
OleDbCommand veri = new OleDbCommand

("SELECT * FROM RoomReg WHERE RoomDate<=" + dateTimePicker1.Text + " AND " + dateTimePicker2.Text + "<RoomOutDate ", conn);
OleDbDataReader oku2;
oku2 = veri.ExecuteReader();
while (oku2.Read())
{
textBox1.Text = oku2["MusID1"].ToString();
textBox2.Text = oku2["MusID2"].ToString();
textBox3.Text = oku2["MusID3"].ToString();
textBox4.Text = oku2["OdaNo"].ToString();
textBox5.Text = oku2["RoomDate"].ToString();
textBox6.Text = oku2["RoomOutDate"].ToString();

if (textBox1.Text == "")
{
}
else
{

connect();
OleDbCommand ver = new OleDbCommand("SELECT * FROM Musteri WHERE M_ID=" + textBox1.Text + "", conn);
OleDbDataReader oku = ver.ExecuteReader();***



ListViewItem item = new ListViewItem(oku["M_ID"].ToString());

item.SubItems.Add(oku["Name"].ToString());
item.SubItems.Add(oku["Surname"].ToString());
item.SubItems.Add(oku["Birthday"].ToString());
item.SubItems.Add(oku["Place"].ToString());
item.SubItems.Add(oku["M_No"].ToString());
item.SubItems.Add(oku2.GetString(1));
item.SubItems.Add(oku2.GetString(5));
item.SubItems.Add(oku2.GetString(6));
listView1.Items.Add(item);
}
}



this is not Working. There are MusID1 So System Enter to read. but giving error on second executereader.

Please help me , Thank you


Continue reading...
 
Back
Top