البته من خودم فكر مي كنم ايراد از جدول ديتابيسم هست ولي نمي دونم اشكالش چيه ؟
چون با يه ديتا بيس ديگه توي همين دستورات جواب داد .
ديتا بيس :
DataB.zip
اين كل كدهاي مهمي هست كه من نوشتم .
public partial class Form1 : Form
{
string strsql;
string strcon;
DataSet ds = new DataSet();
OleDbConnection con = new OleDbConnection();
OleDbDataAdapter da = new OleDbDataAdapter();
DataRow newrow;
OleDbCommandBuilder cb = new OleDbCommandBuilder();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
strcon="Provider=Microsoft.Jet.OLEDB.4.0;"+"Data Source=C:\\ati.mdb";
strsql = "select * from Rsv";
con=new OleDbConnection(strcon);
con.Open();
da=new OleDbDataAdapter(strsql,con);
da.Fill(ds, "Rsv");
}
private void button1_Click(object sender, EventArgs e)
{
newrow = ds.Tables["Rsv"].NewRow();
newrow["C_code"] = textBox2.Text;
newrow["C_Fname"] = textBox3.Text;
newrow["Tel"] = textBox4.Text;
ds.Tables["Rsv"].Rows.Add(newrow);
cb = new OleDbCommandBuilder(da);
da.InsertCommand = cb.GetInsertCommand();
da.Update(ds, "Rsv");
dataGridView1.DataBindings.Add(new Binding("DataSource", ds, "Rsv"));
con.Close();
textBox3.Text = "";
textBox2.Text = "";
textBox4.Text = "";
}