hi
i am using the C#.net in wpf(windows application)
in that iam using a list view with two columns name as item1 and item2 ,
i want to add the fields from the database basing on condition
i am facing the problem is how to add the it to the listview
i am not finding the and option like rows and columns please help me
<br />
i had created dynamically but every thing is running good but the at the listview display only one item is showing
OleDbConnection mcon = new OleDbConnection("provider =Microsoft.JET.OLEDB.4.0;data source=D:\\invoice\\invoice.mdb");
OleDbCommand da = new OleDbCommand("select * from invoicetable where invoiceno='" + invoicenoxearchtxt.Text + "'order by ID asc", mcon);
OleDbDataReader dr;
mcon.Open();
dr = da.ExecuteReader();
ListItem la = new ListItem();
DataSet ds = new DataSet();
DataTable dt = ds.Tables.Add("dt");
dt.Columns.Add("companyname", typeof(System.String));
dt.Columns.Add("customername", typeof(System.String));
if (dr.Read())
{
DataRow dr1 = dt.NewRow();
dr1["companyname"] = dr["companyname"].ToString();
dr1["customername"] = dr["customername"].ToString();
dt.Rows.Add(dr1);
}
GridView gv = new GridView();
foreach (DataColumn item in ds.Tables[0].Columns)
{
GridViewColumn gvc = new GridViewColumn();
gvc.DisplayMemberBinding = new Binding(item.ColumnName);
gvc.Header = item.ColumnName;
gvc.Width = 150f;
gv.Columns.Add(gvc);
}
listView1.View = gv;
listView1.DataContext = ds.Tables["dt"].DefaultView;
mcon.Close();
i had also created the columns in xaml and i had bindeb to the companyname and customername
coding in xamal: note here i had removes the "<>"
ListView Canvas.Left="433" Canvas.Top="147" Height="250" <br />
Name="listView1" Widt h="317.826" SelectionMode="Single" ItemsSource="{Binding}" <br />
listview<br />
<br />
please sugesst me how to do this thing
thank q in advance