All Forums Connectivity
greenpeter 1 post Joined 03/15
02 Aug 2015
Calling Macro from .Net Provider

Hi,
I'm new to TeraData and need to call a Macro from C# using the .Net Provider.
I wasn't able to find any sample code, and not sure what the correct way to do this.
I don't want toe send "exec macroName(param1)" from my code, I would like to have something similar to the way i call procedures.
Can you please point me in the right direction?

NetFx 346 posts Joined 09/06
03 Aug 2015

There is only one way:  
1- Set the TdCommand.Text = "Exec MacroName(?)" and Set the TdCommand.CommandType = CommandType.Text;
2- Add a TdParameter to the TdCommand.Parameters collection
3- Invoke TdCommand.ExecuteReader or TdCommand.ExecuteNonQuery
Executing a Macro is identical to executing a DML statement (Select or Update/Insert/Delete). The ADO.NET specification does not have a separate CommandType for Macro (vs. StoredProcedure or Text). 

You must sign in to leave a comment.