问题标签 [sql-server-2016-express]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1133 浏览

c# - ASP.NET Core 未连接到 Windows Server 2012 上的数据库

我将 ASP.NET Core 应用程序发布到 Windows Server 2012 环境。我创建了一个新网站,将其指向该文件夹,并且运行良好。现在我正在尝试使应用程序连接到数据库。我安装了 SQL Server Express 2016 并编辑了我的项目,以便从数据库中检索数据。将我的“KSP_Backend.mdf”文件放到我的服务器上,并将该文件附加到 SQL Server Management Studio 中。数据库是完全可见的,所以它存在。

现在,当我尝试在已发布的项目文件夹“dotnet KSP_Backend.dll”中运行我的项目时,它给了我以下错误:

这是我使用的“appsettings.json”文件中的连接字符串:

我只是不确定连接字符串是否导致了我的错误。我的防火墙已关闭,LocalDB 已启动并运行。

0 投票
2 回答
1778 浏览

python - How to connect to SQL Server 2016 from Ubuntu 16.04 using python in short time intervals?

I am trying to write data to a SQL Server 2016 Express database from an Ubuntu 16.04 virtual machine using python. The connection is to be set up via FreeTDS, UnixODBC, pyodbc.

The program gets a string of sensor data over a TCP socket, formats it and writes it to a (new or existing) table. This have to happen every x seconds. Therefor I used this answer.

The code evinces a strange behavior and I tried and searched for hours. It sometimes work and sometimes not. I think the problem is to do with connection = pyodbc.connect(conn_str), because often the code is successfully executed once and then gets stuck at this line. After some minutes an Error appears:

Maybe the problem correlates with an open connection but it should be closed at the end of the script. Do you have a solution? How can I catch such errors with a try/except funktion? Please ask if I should provide more information.

Thank you in advance for your help!

This is the code:

tsql -C (I used the latest stable .tar.gz from FreeTDS)

/etc/odbc.ini

isql -v sqlserverdatasource User Password

0 投票
1 回答
87 浏览

sql - sql server 2016 基本选择问题

我有一些行的基本数据库表。请参阅下面的查询。第一个查询从数据库中选择一条记录。你会看到结果。该结果与其他两个结果不同。但是我正在使用不同的列/方法从表中检索相同的记录。正确的记录是第二个和第三个选择查询。

PWTransferID 是主键。PWtransfernumber 是非聚集索引/唯一

我真的很困惑,从未见过这样的问题。任何人都可以为我阐明这一点。几乎就像数据库在某个地方坏了一样。

在此处输入图像描述

0 投票
1 回答
3778 浏览

c# - Cannot create or find Schema in SQL Server 2016 Express

My program creates databases and tables at runtime. My understanding of Schema is it is a conceptual folder for multiple databases and databases tables. So I wrote some meaningless code just to test out what schema would do to my code.

My program use SQL Server Authentication instead of Windows Authentication, and create database and tables under the username of TmpUser instead of sa.

If I create a table by CREATE TABLE TmpTable, I get dbo.TmpTable for table name. If I explicitly type a new schema in CREATE TABLE abc.TmpTable, I then get the following exception because the schema does not exist:

SqlException: The specify schema name either does not exist or you do not have permission to use it

I went into SSMS and manually create a schema by executing CREATE SCHEMA abc. SSMS outputs saying the schema of abc has been successfully created. But in SSMS Object Explorer > Security > I see no Schema name nor anything else named abc.

Where is my Schema? If abc was not created, then why was CREATE SCHEMA abc executed and what did it create?

I went back to Visual Studio and CREATE TABLE abc.TmpTable again, still I receive the same exception.

0 投票
1 回答
39 浏览

c# - 参数化查询是否删除保留关键字和符号

如果是这样,如果我的 varchar 包含 ; 或 [ 或将自动删除的关键“创建”?没想到这么简单,避免sql注入的参数化机制是什么?

0 投票
1 回答
4212 浏览

vb6 - VB6 和 Sql server 2016 Express 连接字符串

在我们的旧 vb6 应用程序连接字符串之一如下:

如果我尝试连接这些选项,它将不起作用,所以我很感兴趣为什么这两个选项:

不被忽视?

只需提及该应用程序正在通过本地网络连接到 Windows Server 2016 Standard 上的 Sql Server 2016 Express。

0 投票
1 回答
1648 浏览

sql-server - SQL Server 链接服务器到 MS Access - DSN 体系结构不匹配错误

我正在使用 SQL Server 2016 Express,尝试通过 ODBC 数据源连接到网络上另一台服务器上的 Access 数据库。我查阅了许多教程并尝试了各种不同的方法,但无法使连接正常工作。最终我似乎陷入了这个错误:

[Microsoft][ODBC Driver Manager] 指定的 DSN 包含驱动程序和应用程序之间的体系结构不匹配(Microsoft SQL Server,错误:7303)

为了排除权限和网络问题,我已将数据库复制到本地计算机以尝试创建测试连接。我已验证 Microsoft Access 的安全设置已关闭(意味着没有用户名/密码可登录)。我确保使用 32 位版本的 ODBC 数据源管理器(在 中Windows\SysWOW64\),在 SQL Server 中尝试了各种设置,甚至尝试通过 T-SQL 代码直接创建链接服务器,如下所示:

以下是我用来尝试创建此连接的当前设置,但我不断收到此错误:

ODBC 数据源

新建链接服务器对话框

链接服务器安全设置

错误信息

请注意,我还尝试了“新建链接服务器”对话框的“安全”选项卡上的每个设置,但每次都收到错误消息。

如果有人知道我在这里可能缺少什么,请告诉我。

编辑:这里有一个类似的问题,但它是一个旧线程,并且高度评价的答案对我来说是不成功的(我已经尝试过):

指定的 DSN 包含驱动程序和应用程序之间的体系结构不匹配。JAVA

解决我的问题的关键是我需要专门下载 64 位版本的 Access ODBC 驱动程序,可以在这里下载:

https://www.microsoft.com/en-US/download/details.aspx?id=13255

0 投票
0 回答
154 浏览

azure-sql-database - SQL Server 兼容级别 130 与 MD5

我已经阅读了 SQL Server 中兼容级别 130 的文档。明确提到不支持 MD5(已弃用)。

https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-database-transact-sql-compatibility-level#differences-between-compatibility-level-130-and-level-140

但是,我有一个使用 MD5 算法的计算列。

我将我的数据库从兼容级别 120 更改为 130。

我在这个表中插入了一个新行并成功生成了 MD5 哈希。

明明没破...

如果我将更改转移到生产环境,如何确保我现有的 MD5 列不会导致损坏?

0 投票
3 回答
332 浏览

sql - Sql server 2016 在第 5 个逗号后拆分

我需要拆分以下字符串

0 投票
1 回答
523 浏览

sql-server-2008 - SQL Server 的大型驱动器空间不足

我有一个更新 SQL Server 2008R2 数据库的 VB.Net 程序。

该磁盘使用 86.2Gb 和 126Gb,因此有大量可用空间。

在此处输入图像描述

如您所见,自动增长已设置,但我在各个线程上收到以下错误消息:

无法为数据库 'MyDB' 中的对象 'sys.syscolpars'.'nc' 分配空间,因为 'PRIMARY' 文件组已满。通过删除不需要的文件、删除文件组中的对象、向文件组添加其他文件或为文件组中的现有文件设置自动增长来创建磁盘空间。

MDF 文件当前大小为 9Gb。

如果设置了 Autogrowth,并且有足够的磁盘空间,为什么会发生这种情况?

编辑:

好的,进一步的测试提供了以下...

在这种情况下,SQL 服务器不是怀疑的 2008R2,而是 2014 SQLExpress ......对不起,这方面的流浪汉;我把我的服务器搞混了...

当我在完全相同的 2008R2 上尝试此操作时,它似乎可以正常工作而不会产生错误消息。

那么,问题似乎是 SQLexpress 的大小是否有限?