hi,
i have created database by adding add->new item->service database,
and i used the following code to save the data
private
void btn_save_Click(object sender, EventArgs e)
{
try
{
string c = Application.StartupPath;
SqlConnection con = new SqlConnection(@"AttachDbFilename=G:\egprogram_with_db\egprogram_with_db\bin\Debug\Database1.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
con.Open();
SqlCommand cmd = new SqlCommand("Insert into Codedetails values('TF','" + txt_productcode.Text + "','" + txt_productname.Text + "','" + txt_brandcode.Text + "','" + txt_brandname.Text + "')", con);
cmd.ExecuteNonQuery();
con.Close();
assigngrid_codeentry();
}
catch (Exception ex)
{
}
}
here the datas saved correctly...but in the next time, its doesnt appear.
public
void assigngrid_codeentry()
{
try
{
SqlConnection con = new SqlConnection(@"AttachDbFilename=G:\egprogram_with_db\egprogram_with_db\bin\Debug\Database1.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
con.Open();
SqlDataAdapter da = new SqlDataAdapter("Select * from Codedetails", con);
DataSet ds = new DataSet();
da.Fill(ds);
dataGridView_codeentry.DataSource = ds.Tables[0];
con.Close();
}
catch (Exception ex)
{
}
}
my doubt is datas are saving inside the bin/debug or outside the bin...because i can find two mdf file in the folder.
Plz clear me this doubt