Forum > Databases
how to connect msSql server version 16
toby:
rcmz
check out sqlite too - easier to install then mariadb/mysql
Zvoni
how about his statement?
'What component do you recommend to connect to msSql server version 16?'
but then again he could already be connecting and working on the server but wants to know what you recommend he use so he can redo all his work based on what you say
'Do you know, if his requirements are predefined? Like working in a company, where he is required to write a tool accessing there Database-Server, which runs MS SQL?.'
do you think his boss of your imaginary company would be happy knowing the guy he hired to make an advanced tool to use on his commecial database - needs to find out how to even connect to the server?
ignore list - what is this irc in the 1980's
didn't you mean to say *plonk*
your whole reply sounds like an unconscious confession and makes me think of the guy who lied on his resume and got hired to do db2 programming and then went to programming forums to supplement his lack of knowledge and keep up the sham - his fellow programmers got tired of his crappy code and got him fired
your signature sounds a bit pscho maoist too
dsiders:
--- Quote from: toby on July 09, 2024, 07:17:34 pm ---ignore list - what is this irc in the 1980's
didn't you mean to say *plonk*
--- End quote ---
Absolutely. *PLONK*
rcmz:
Hi,
thx for your replys I will give them a try.
I use Firebird since 2007, have also worked with MySql, Oracle Progres, PostgresSql and msSql server but with Delphi.
Since 2018 I been moving my work to Lazarus using only Firebird with the ibDac component of devart.
I have a client that works exclusively with msSql server and until this time I had no use to connect to msSql server. There is a component from devart to connect to msSql but my client is not willing to pay the price.
TIA
Ramiro
dseligo:
I use ZEOSdbo components to connect to MSSQL.
Below is example how to connect from code, but of course you can put components to forms or data modules too (and set them in Object inspector). P.S.: ZEOSdbo is in Online Package Manager, but I still use 7.2.14 version, so code below maybe needs little adjusting to work with newest version.
Beside this, you'll also need library such as https://www.freetds.org/.
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program mssql; {$APPTYPE CONSOLE} uses SysUtils, ZConnection, ZDataset; // add zcomponent to Lazarus' Project Inspector requirements const DBName = 'YOUR_DB_NAME'; DBHost = 'YOUR_DB_HOST'; DBUser = 'YOUR_DB_USERNAME'; DBPassword = 'YOUR_DB_PASSWORD'; var ZCMSSQL: TZConnection; ZQuery: TZQuery; begin try ZCMSSQL := TZConnection.Create(nil); ZCMSSQL.ClientCodepage := 'UTF-8'; ZCMSSQL.Catalog := DBName; ZCMSSQL.Database := DBName; ZCMSSQL.Protocol := 'FreeTDS_MsSQL>=2005'; ZCMSSQL.User := DBUser; ZCMSSQL.Password := DBPassword; ZCMSSQL.HostName := DBHost; ZCMSSQL.LoginPrompt := False; try ZCMSSQL.Connect; except WriteLn('Error connecting to ''' + DBName + ''' (' + DBHost + ').'); end; if not ZCMSSQL.Connected then Exit; ZQuery := TZQuery.Create(nil); try ZQuery.Connection := ZCMSSQL; ZQuery.SQL.Text := 'select top 10 "your_field_name" ' + 'from "your_table" ' + 'where "field_name" > :your_field_name ' + 'order by 1 desc'; ZQuery.ParamByName('your_field_name').AsInteger := 10; ZQuery.Open; While not ZQuery.EOF do begin WriteLn(ZQuery.Fields[0].AsString); ZQuery.Next; end; finally ZQuery.Free; end; finally ZCMSSQL.Disconnect; ZCMSSQL.Free; end;end.
rcmz:
Thx!!!
I will give it a try
Ramiro
Navigation
[0] Message Index
[*] Previous page