简体   繁体   中英

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...

I did a google search and found this: http://www.prowiki.org/wiki4d/wiki.cgi?DatabaseBindings

But I found nothing about connecting to SQL Server...

One option is to use the OpenDBX bindings available here: 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.

It has a C api so it is not very pretty, but it should work.

Another option is to use ODBC. Bindings are available at https://github.com/AndrejMitrovic/DWinProgramming .

I suggest you write a binding/wrapper for FreeTDS: http://www.freetds.org/ . That is the best, open-source library you can use to connect to the SQL server. An alternative would perhaps be unixODBC and iODBC, but as far as I know they both use FreeTDS for Microsoft SQL Server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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