22-02-18, 09:18 PM
(آخر تعديل لهذه المشاركة : 22-02-18, 09:21 PM {2} بواسطة شمس الدين 03.)
السلام عليكم
بارك الله فيك استاذ ابو عمر
عندي خطأ بالمفال
هنا
https://www.gulf-up.com/downloadf-151931...1-zip.html
كيف اجلب من قاغدة البيانات الى الداتا
بارك الله فيك استاذ ابو عمر
عندي خطأ بالمفال
هنا
https://www.gulf-up.com/downloadf-151931...1-zip.html
كود :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace test_05
{
public partial class Form1 : Form
{
private OleDbConnection connection = new OleDbConnection();
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
DataTable dt = new DataTable();
OleDbCommand command = new OleDbCommand("select product From chms", connection);
OleDbDataAdapter da = new OleDbDataAdapter(command);
da.Fill(dt);
for (int i = 0; i < 5; i++)
{
dataGridView1.Columns.Add("", "col" + i);
}
for (int i = 0; i < 9; i++)
{
dataGridView1.Rows.Add("", "");
}
for (int i = 0; i < 10; i++)
{
for (int u = 0; u < 5; u++)
{
dataGridView1.Rows[i].Cells[u].Value ="pr";
}
}
}
private void Form1_Load(object sender, EventArgs e)
{
try
{
connection.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\chsxp.accdb;
Persist Security Info=False;";
connection.Open();
label1.Text = "connection";
connection.Close();
}
catch (Exception ex)
{
MessageBox.Show("error " + ex);
}
}
}
}كيف اجلب من قاغدة البيانات الى الداتا
