sql server

Discussion forum about all things Team Developer 7.x
Posts: 5
Joined: 20 Jan 2018, 15:08
Location: Rio de Janeiro, Brazil

sql server

Post by matheuspmoraes » 20 Jan 2018, 22:42

Hello everyone
I'm starting to study team developer ... I have a question ... I have a form with a data field (name) and a button. In the sql server I have a database called test and a table named table1 with a column (names). I want when the user clicks the button, the system saves as a record in the sql server.
I also want to know a way to bring the sql server names field to my application.
thank you

Posts: 6
Joined: 10 Mar 2017, 07:41
Location: Tallinn, Estonia

sql server

Post by Riuks » 27 Jan 2018, 22:42

I suggest to install samples. Installer is downloadable from OpentText- same place where u got TD.

In folder Samples\Connectivity\SQLServer u can find way to connect to sqlserver.
Another great place where u can find a lot of information is here:
https://wiki.tdcommunity.net/index.php?title=Main_Page and another samples

To connect to sqlserver i suggest here another way- use udl:
You need to install SQLNativeClient: https://www.google.ee/search?q=sqlncli1 ... e&ie=UTF-8

Set SqlDatabase=''
Set SqlUser=''
Set SqlPassword=''
Set SqlUDL='[oledb]
Provider=SQLNCLI11.1;Persist Security Info=False;User ID=USERNAME;Password=PASSWORD;Initial Catalog=DATABASE;Data Source=HOST;Trusted_Connection=No;MARS Connection=True;'

If NOT SqlConnect( hMSSql )
Set sError='Error:NO Connect'
Return FALSE
! and next do what u need to do:
If SqlPrepareAndExecute(hMSSql,'SELECT ... FROM ... WHERE ... INTO :.., ;.. ')
While SqlFetchNext(hMSSql,mA)

If SqlPrepareAndExecute(hMSSql,'INSERT INTO (...) VALUES (...)')

If SqlPrepareAndExecute(hMSSql,'UPDATE TBNAME SET ..., ... WHERE ...')
!And ofcouse - dont mis to commit/ rollback and disconnect asap.
Call SqlCommit( hMSSql )
Call SqlDisconnect(hMSSql )

Best regards,

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 0 guests