PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Executing SQL Scripts from WinDev
Executing SQL Scripts from WinDev
Débuté par guest, 21 aoû. 2012 15:20 - 1 réponse
Posté le 21 août 2012 - 15:20
Hi,

I have created an SQL script to make some triggers on different tables in an MS-SQL database.

These scripts, I would like to run from my WinDev app, since the clients not have "MS SQL Server Management Studio" installed.

I Tried to put my script into a "pure SQL" query but got errors (SQL Comment was first error), then I was thinking about SQLExec but here I need to SQLconnect to the database, but I already have a connection to it using OleDB using Hchangeconnection?

In Clarion I just did:
AnyFileConnected{PROP:SQL} = 'Whatever sql command I wanted'
Is there something similar in WD?

Cheers
Tor-Bjarne
Posté le 21 août 2012 - 17:38
Hi Tor-Bjarne,
you should try HExecuteSQLQuery with withoutCorrection parameter.
What I normally do with Clarion is to write a set of SQL queries in
a file, separated with a GO. So I'm reading line by line, saving that
in a cstring variable until I find a GO and then execute a Prop:SQL. I
guess you can do the same with WD replacing Prop:SQL by
HExecuteSQLQuery.
Hope this helps.

Mauricio
Tor-Bjarne a écrit :
Hi,

I have created an SQL script to make some triggers on different tables in an
MS-SQL database.

These scripts, I would like to run from my WinDev app, since the clients not
have "MS SQL Server Management Studio" installed.

I Tried to put my script into a "pure SQL" query but got errors (SQL Comment
was first error), then I was thinking about SQLExec but here I need to
SQLconnect to the database, but I already have a connection to it using OleDB
using Hchangeconnection?

In Clarion I just did:
AnyFileConnected{PROP:SQL} = 'Whatever sql command I wanted'
Is there something similar in WD?

Cheers
Tor-Bjarne


--
Mauricio Nicastro
www.tdcsoftware.com