I have one database as company
In that I have 4 table: Alpha,Beta,Gamma,like that
In this 1st table with sql connection is working
Then I done same procedure for remaining tables but it show Error as
Beta tableAdapter does not exist namespace what is the meaning for this why it works for only 1st table but does not work for remaining tables.
and also i am changing table name corresponding sqlconnection
{
CompanyDataSet dataSet = new CompanyDataSet();
CompanyDataSetTableAdapters. AlphaTableAdapter adapter = new CompanyDataSetTableAdapters. AlphaTableAdapter();
adapter.Fill(dataSet. Alpha);
comboBox1.DataSource = dataSet. Alpha; showing error in these only line
comboBox1.DisplayMember = "Printname";
}
{
CompanyDataSet dataSet = new CompanyDataSet();
CompanyDataSetTableAdapters. BetaTableAdapter adapter = new CompanyDataSetTableAdapters. BetaTableAdapter();
adapter.Fill(dataSet.Beta);
comboBox1.DataSource = dataSet.Beta;
comboBox1.DisplayMember = "Printname";
}

Durga VelusamyPosted Mar 25, 2015, 4:50 AM
{
InitializeComponent();
BasDataSet dataSet = new BasDataSet();
BasDataSetTableAdapters.deviTableAdapter adapter = new BasDataSetTableAdapters.deviTableAdapter();
adapter.Fill(dataSet.devi);
comboBox1.DataSource = dataSet.devi;
comboBox1.DisplayMember = "CustomerId";
}
private void button1_Click(object sender, EventArgs e)
{
{
SqlConnection con = new SqlConnection(@"server=CSE-PC; integrated security=true; Database=Bas");
con.Open();
SqlCommand cmd1 = new SqlCommand("insert into devi Values('" + comboBox1.Text + "',+'" + comboBox2
.Text + "','" + comboBox3.Text + "','" + comboBox4.Text + "','" + comboBox5.Text + "','" + comboBox6.Text + "','" + comboBox7.Text + "')", con);
cmd1.ExecuteNonQuery();
con.Close();
MessageBox.Show("Added Successfully");
comboBox1.Text = "";
comboBox2.Text = "";
comboBox3.Text = "";
comboBox4.Text = "";
comboBox5.Text = "";
comboBox6.Text = "";
comboBox7.Text = "";
}
in the second form i have same database with different table name
instead of devi table i have table name as durga. this form use the bas database and devi table name its working.
but in the 2nd form bas database and durga table its not working. why? just i have change
the table only in the binding code it shows error at i have drag red background
public Form1()
{
InitializeComponent();
BasDataSet dataSet = new BasDataSet();
BasDataSetTableAdapters.durgaTableAdapter adapter = new BasDataSetTableAdapters.durgaTableAdapter();
adapter.Fill(dataSet.durga);
comboBox1.DataSource = dataSet.durga;
comboBox1.DisplayMember = "CustomerId";
}
private void button1_Click(object sender, EventArgs e)
{
{
SqlConnection con = new SqlConnection(@"server=CSE-PC; integrated security=true; Database=Bas");
con.Open();
SqlCommand cmd1 = new SqlCommand("insert into durga Values('" + comboBox1.Text + "',+'" + comboBox2
.Text + "','" + comboBox3.Text + "','" + comboBox4.Text + "','" + comboBox5.Text + "','" + comboBox6.Text + "','" + comboBox7.Text + "')", con);
cmd1.ExecuteNonQuery();
con.Close();
MessageBox.Show("Added Successfully");
comboBox1.Text = "";
comboBox2.Text = "";
comboBox3.Text = "";
comboBox4.Text = "";
comboBox5.Text = "";
comboBox6.Text = "";
comboBox7.Text = "";
}
Riddhi ValechaPosted Mar 25, 2015, 4:28 AM