conn.ConnectionString c#连接sdf数据库的连接字符串如何写啊?
conn.ConnectionString="Provider=Microsoft.SQL.Server.4.0;NETFramework:databasepasswor...
conn.ConnectionString = "Provider=Microsoft.SQL.Server.4.0;NET Framework:database password=ak47;Data Source=//text.sdf" ;
报的错是 未在本地计算机上注册“Microsoft.SQL.Server.4.0”提供程序 展开
报的错是 未在本地计算机上注册“Microsoft.SQL.Server.4.0”提供程序 展开
推荐于2017-09-25 · 知道合伙人软件行家
关注
展开全部
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.SqlServerCe; //这里是重点,要有驱动
namespace testc
{
public partial class Form1 : Form
{
SqlCeConnection sqlceCon = new 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:\\Program Files\\Microsoft SQL Server Compact Edition\\v3.5\\Samples\\Northwind.sdf");
sqlceCon.Open();
SqlCeDataAdapter adptrOdbc = new SqlCeDataAdapter("select * from customers", sqlceCon);
adptrOdbc.Fill(dt);
dataGridView1.DataSource = dt;
}
}
}
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.SqlServerCe; //这里是重点,要有驱动
namespace testc
{
public partial class Form1 : Form
{
SqlCeConnection sqlceCon = new 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:\\Program Files\\Microsoft SQL Server Compact Edition\\v3.5\\Samples\\Northwind.sdf");
sqlceCon.Open();
SqlCeDataAdapter adptrOdbc = new SqlCeDataAdapter("select * from customers", sqlceCon);
adptrOdbc.Fill(dt);
dataGridView1.DataSource = dt;
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询