i want to make the items in the listview come everyone in a line when it get the data needed from sql. what am trying to do is when i search for a text in the database it shows in the listview and when i search for a new text and show it also in the listview but am recieving them in the same line while i want it to switch to a new line whenever i start a new search. here is the code:

 SqlConnection connection = new SqlConnection("Data Source= localhost; Initial Catalog=wform database; User ID = sa; Password=look@me");
                            string str = "select Add_user From msn_user_tbl where Add_user='" + searchtextbox.Text + "'";

                        SqlCommand  com = new SqlCommand(str, connection);
                        SqlDataAdapter     ad = new SqlDataAdapter(com);
                         DataSet   ds = new DataSet();

                            SqlDataReader reader = com.ExecuteReader();
                            for (int i = 0; i < reader.FieldCount; i++)

                                ColumnHeader ch = new ColumnHeader();
                                ch.Text = reader.GetName(i);

                            ListViewItem itmX;   

                            while (reader.Read())
                                itmX = new ListViewItem();
                                itmX.Text = reader.GetValue(0).ToString();

                                for (int i = 1; i < reader.FieldCount; i++)


Related posts

Recent Viewed