简体   繁体   English

如何连接到SQL Server?

[英]How to connect to SQL Server?

I use SQL Server 2008 R2 and SQL Server 2012 with C#, but I wonder how can I connect to them using D... 我将SQL Server 2008 R2和SQL Server 2012与C#一起使用,但是我不知道如何使用D连接到它们。

I did a google search and found this: http://www.prowiki.org/wiki4d/wiki.cgi?DatabaseBindings 我做了一个Google搜索,发现了这个: http : //www.prowiki.org/wiki4d/wiki.cgi?DatabaseBindings

But I found nothing about connecting to SQL Server... 但是我没有发现有关连接到SQL Server的任何信息...

One option is to use the OpenDBX bindings available here: https://github.com/rikkimax/Derelict_Extras---OpenDBX . 一种选择是使用此处提供的OpenDBX绑定: https : //github.com/rikkimax/Derelict_Extras---OpenDBX OpenDBX provides access to multiple db servers , using a unified interface, including MS SQL Server , PostgreSQL , SQLite and others. OpenDBX使用统一的界面(包括MS SQL ServerPostgreSQLSQLite等)提供对多个数据库服务器的访问。

It has a C api so it is not very pretty, but it should work. 它具有C api,因此不是很漂亮,但是应该可以使用。

Another option is to use ODBC. 另一种选择是使用ODBC。 Bindings are available at https://github.com/AndrejMitrovic/DWinProgramming . 绑定位于https://github.com/AndrejMitrovic/DWinProgramming

I suggest you write a binding/wrapper for FreeTDS: http://www.freetds.org/ . 我建议您为FreeTDS编写一个绑定/包装器: http ://www.freetds.org/。 That is the best, open-source library you can use to connect to the SQL server. 那是您可以用来连接到SQL Server的最好的开源库。 An alternative would perhaps be unixODBC and iODBC, but as far as I know they both use FreeTDS for Microsoft SQL Server. 另一种可能是unixODBC和iODBC,但据我所知,它们都使用Microsoft SQL Server的FreeTDS。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM