Hi, i want to look only two column from SqlCe database in datagird based on the Row Index, However I have tried and googled around on many things along with looking through here, but now only first value of that column is showing in datagrid. Any help is greatly appreciated! Thanks in advance,
private void CBSalesOrderNo_SelectedIndexChanged(object sender, EventArgs e)
{
string conSTR = "Data Source=" +
(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)) +
"\\freedom.sdf;Persist Security Info=False";
try
{
SqlCeConnection conn = new SqlCeConnection(conSTR);
conn.Open();
string code = "SELECT * FROM Items WHERE Salesorder ='" + CBSalesOrderNo.Text + "'";
SqlCeDataAdapter da = new SqlCeDataAdapter(code, conn);
SqlCeCommandBuilder cmd = new SqlCeCommandBuilder(da);
DataSet dset = new DataSet();
da.Fill(dset);
if (CBSalesOrderNo.SelectedIndex > -1)
{
txtShipmentNo.Text = dset.Tables[0].Rows[0]["Shipmentno"].ToString();
txtcustName.Text = dset.Tables[0].Rows[0]["Custname"].ToString();
txtitem.Text = dset.Tables[0].Rows[0]["Itemno"].ToString();
List bundleList = new List();
string data = dset.Tables[0].Rows[0]["Bundleno"].ToString();
string data1 = dset.Tables[0].Rows[0]["Obtainable"].ToString();
if (!string.IsNullOrEmpty(data) && !string.IsNullOrEmpty(data1))
{
bundleList.Add(new BundleDetails { BundleNo = data });
bundleList.Add(new BundleDetails { Obtainable = data1 });
dataGrid1.DataSource = bundleList;
}
}
}
catch (SystemException se)
{
MessageBox.Show(se.Message);
}
}
public class BundleDetails
{
public string BundleNo { get; set; }
public string Obtainable { get; set; }
}
does any one help me...
Upendra Pratap ShahiPosted Jun 19, 2015, 7:41 AM
Hitendrasing SisodiyaPosted Jun 19, 2015, 7:34 AM
Hitendrasing SisodiyaPosted Jun 19, 2015, 7:33 AM
Upendra Pratap ShahiPosted Jun 18, 2015, 9:11 AM
Sreekanth ReddyPosted Jun 18, 2015, 8:16 AM