当前位置:Gxlcms > 数据库问题 > c# 连接本地的sdf数据库文件

c# 连接本地的sdf数据库文件

时间:2021-07-01 10:21:17 帮助过:63人阅读

  namespace testc
{
    public partial class Form1 : Form
    {
        SqlCeConnection sqlceCon = new SqlCeConnection();    //SqlCeConnection 
        SqlCeCommand sqlCeCom = new SqlCeCommand();
        DataTable dt = new DataTable();           public Form1()
        {
            InitializeComponent();
        }           private void Form1_Load(object sender, EventArgs e)
        {
            sqlceCon = new SqlCeConnection("Data Source=C:\\Northwind.sdf");
            sqlceCon.Open();               SqlCeDataAdapter adptrOdbc = new SqlCeDataAdapter("select * from customers", sqlceCon);
            adptrOdbc.Fill(dt);               dataGridView1.DataSource = dt;
        }      
    }
}

c# 连接本地的sdf数据库文件

标签:mod   test   customer   partial   驱动   ada   command   datagrid   art   

人气教程排行