'Declaration Public Class UniMacro Implements System.ICloneable
public class UniMacro : System.ICloneable
'Declaration Public Class UniMacro Implements System.ICloneable
public class UniMacro : System.ICloneable
The UniMacro class represents custom macro that can be used while executing UniSQL statements. For information on UniSQL and using macros please refer to article UniSQL.
Individual macros are accessed through UniConnection.Macros property of UniConnection. This property represents UniMacroCollection, whose items are used in UniSQL statements. Each UniConnection object has its own collection of macros.
UniConnection conn = new UniConnection(); //Connecting to Oracle server through OraDirect .NET conn.ConnectionString = "provider=OraDirect;Password=tiger;User Id=Scott;Host=ora920;"; //Define macros for tables dept UniMacro mac = new UniMacro("tablename", "test.dept", "MySQL"); conn.Macros.Add(mac); UniMacro mac2 = new UniMacro("tablename", "dept", "Oracle"); conn.Macros.Add(mac2); //Define query that uses the macro UniCommand cmd = new UniCommand("SELECT Count(*) FROM {tablename}"); cmd.Connection = conn; conn.Open(); try { //Run the query and make sure it is executed correctly string response = cmd.ExecuteScalar().ToString(); MessageBox.Show(response); } finally { conn.Close(); }
Dim conn As New UniConnection() 'Connecting to Oracle server through OraDirect .NET conn.ConnectionString = "provider=OraDirect;Password=tiger;User Id=Scott;Host=ora920;" 'Define macro for table dept Dim mac As New UniMacro("tablename", "test.dept", "MySQL") conn.Macros.Add(mac) Dim mac2 As New UniMacro("tablename", "dept", "Oracle") conn.Macros.Add(mac2) 'Define query that uses the macro Dim cmd As New UniCommand("SELECT Count(*) FROM {tablename}") cmd.Connection = conn conn.Open() Try 'Run the query and make sure it is executed correctly Dim response As String = cmd.ExecuteScalar().ToString() MessageBox.Show(response) Finally conn.Close() End Try
System.Object
Devart.Data.Universal.UniMacro
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2