morrteza323
شنبه 25 دی 1389, 20:58 عصر
سلام دوستان عزیز من با این کد به بانکم (اکسس)اطلاعات وارد می کنم . خوب حالا می خوام با کد نویسی اطلاعات جدولم رو داخل دیتاگریدویو نمایش بدم.تو سایت سرچ کردم.اما هیچ کدوم از پست ها کمکم نکرد.لطفا منو راهنمایی کنید.
System.Data.OleDb.OleDbConnection ocn = new System.Data.OleDb.OleDbConnection();
System.Data.OleDb.OleDbCommand ocm = new System.Data.OleDb.OleDbCommand();
ocn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=db1.accdb";
ocm.Connection = ocn;
ocm.CommandText = "INSERT INTO mbank (company_name,cala_p)VALUES(@a,@b)";
ocm.Parameters.Clear();
ocm.Parameters.AddWithValue("@a", textBox1.Text);
ocm.Parameters.AddWithValue("@b", textBox2.Text);
ocn.Open();
ocm.ExecuteNonQuery();
ocn.Close();
ocm.Dispose();
System.Data.OleDb.OleDbConnection ocn = new System.Data.OleDb.OleDbConnection();
System.Data.OleDb.OleDbCommand ocm = new System.Data.OleDb.OleDbCommand();
ocn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=db1.accdb";
ocm.Connection = ocn;
ocm.CommandText = "INSERT INTO mbank (company_name,cala_p)VALUES(@a,@b)";
ocm.Parameters.Clear();
ocm.Parameters.AddWithValue("@a", textBox1.Text);
ocm.Parameters.AddWithValue("@b", textBox2.Text);
ocn.Open();
ocm.ExecuteNonQuery();
ocn.Close();
ocm.Dispose();