Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 247
  • Last Modified:

Create Store Procedure From Delphi

I am trying to create a store procedure from my Delphi program. I use an ADOComand to execute the procedure create script.I find 2 problems...if i do not use GO in my statement in script i get error becouse 'Create Procedure' must be firs and if i use GO i get 'Incorect syntax near GO statement error'. EOLEException Error. In SQL Querry Analizer the script work fine so...what could be the problem ?.or...how elese can i create my procedure at program runtime ?...thanks you all
0
dannertb
Asked:
dannertb
  • 2
1 Solution
 
dannertbAuthor Commented:
By the way ..Database Server is MSSQLServer 2000
0
 
pcsentinelCommented:
Dont use GO, I just tried it with an ADOCommand and a ADOConnection,

in the ADOCommand  Text property I had

CREATE PROCEDURE LISTALL AS
SELECT * FROM TestTable

the commandtype was set to cmdText

then on a button I just had

ADOCommand1.execute and it worked ok
0
 
dannertbAuthor Commented:
ExecuteInit:=TADOCommand.Create(main);
 ExecuteInit.Connection:=Conn;
 ExecuteInit.CommandType:=cmdText;
 ExecuteInit.ParamCheck := False;
 ExecuteInit.CommandText:=Memo1.Text;
 ExecuteInit.Execute;
 ExecuteInit.Free;

It worked OK in this way...my problem was that i wanted to create more than one procedure in one script...but separtely it works fine...10x
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now