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