Click here to Skip to main content
15,884,099 members

Comments by SR.Rizwan (Top 3 by date)

SR.Rizwan 10-Aug-12 2:50am View    
how can i change the folder and specify it in the installer?
SR.Rizwan 29-Jul-12 11:21am View    
yes i am fetching the whole row. below is my code. can't figure it out where is the problem.

private void ProductForm_Shown(object sender, EventArgs e)
{
SqlCeConnection Connection = new SqlCeConnection(ConString);
Connection.Open();
SqlCeDataAdapter da = new SqlCeDataAdapter("Select * from CastingMaterial", Connection);
DataTable dt = new DataTable();
da.Fill(dt);
for (int i = 0; i < dt.Rows.Count; i++)
{
ProductsComboBox.Items.Add(dt.Rows[i]["PartName"]);

}
ProductsComboBox.DisplayMember = "PartName";
ProductsComboBox.ValueMember = "PartId";
Connection.Close();
}

private void ProductsComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
int ProductIndex = ProductsComboBox.SelectedIndex;
string productName = ProductsComboBox.Text.ToString();
int ProductId =Convert.ToInt32(ProductsComboBox.SelectedValue);
SqlCeConnection Connection = new SqlCeConnection(ConString);
Connection.Open();
String Query = "SELECT * From CastingMaterial where PartId=@PartId";
SqlCeDataAdapter da = new SqlCeDataAdapter(Query, Connection);
da.SelectCommand.Parameters.AddWithValue("PartId", ProductId);
DataSet ds = new DataSet();
SqlCeCommandBuilder commandBuilder = new SqlCeCommandBuilder(da);

BindingSource bsource = new BindingSource();

da.Fill(ds, "CastingMaterial");
bsource.DataSource = ds.Tables["CastingMaterial"];
Productgv.DataSource = bsource;
Connection.Close();
}
SR.Rizwan 29-Jul-12 8:33am View    
it is giving me the error "Object reference not set to an instance of an object."
string productName = ProductsComboBox.Text.ToString(); This line works fine, it contains the value of productName.
what i am doing wrong?