我正在尝试使用LINQ to SQL来更新我的数据库,但是当我在更新它之后尝试刷新我的表时,出现了一个错误:
无法导入此数据库。它是不受支持的SQL Server版本或不受支持的数据库兼容性。
我很感激某人的帮助
我的代码中的一些随机代码段,不确定它们是否相关:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
-
private void button3_Click(object sender, EventArgs e)
{
ProjectDBDataContext Context = new ProjectDBDataContext();
var r =
from b in Context.TeacherDetails
where b.TeacherId <= 2
select b;
foreach (TeacherDetail b in r)
b.First_Name = "Jerry";
Context.SubmitChanges();
}
-
CREATE TABLE [dbo].[TeacherDetails] (
[TeacherId] INT IDENTITY (1, 1) NOT NULL,
[First Name] NVARCHAR (50) NULL,
[Surname] NVARCHAR (50) NULL,
[Email Address] NVARCHAR (50) NULL,
[Password] NVARCHAR (50) NULL,
[Title] NVARCHAR (50) NULL,
[Username] NVARCHAR (50) NULL,
CONSTRAINT [PK_TeacherDetails] PRIMARY KEY CLUSTERED ([TeacherId] ASC)
);
这是连接字符串的意思吗?
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="Project.Properties.Settings.ProjectDBConnectionString"
connectionString="Data Source= (LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\ProjectDB.mdf;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>