CreateCommand Method (SugarConnection)
Creates and returns a
SugarCommand object associated with the
SugarConnection.
In this sample
SugarCommand object is created. It is automatically associated with
SugarConnection that created it.
public void CreateSugarCommand(string myConnString)
{
SugarConnection sugarConnection = new SugarConnection(myConnString);
SugarCommand sugarCommand = sugarConnection.CreateCommand();
sugarCommand.CommandText = "INSERT INTO Campaigns (name, campaign_type, end_date, status) VALUES ('Sale campaign', 'Email', '2016-12-12', 'Active')";
sugarConnection.Open();
try
{
sugarCommand.ExecuteNonQuery();
}
finally
{
sugarConnection.Close();
}
}
Public Sub CreateSugarCommand(ByVal myConnString As String)
Dim sugarConnection As New SugarConnection(myConnString)
Dim sugarCommand As SugarCommand = sugarConnection.CreateCommand()
sugarCommand.CommandText = "INSERT INTO Campaigns (name, campaign_type, end_date, status) VALUES ('Sale campaign', 'Email', '2016-12-12', 'Active')"
sugarConnection.Open()
Try
sugarCommand.ExecuteNonQuery()
Finally
sugarConnection.Close()
End Try
End Sub
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