Dynamicweb Namespace > Database Class > ExecuteNonQuery Method : ExecuteNonQuery(String,Int32,Boolean,String) Method |
true
the query is executed in a transaction.
'Declaration
Public Overloads Shared Function ExecuteNonQuery( _ ByVal sql As String, _ ByVal commandTimeout As Integer, _ ByVal useTransaction As Boolean, _ ByVal database As String _ ) As Integer
public static int ExecuteNonQuery( string sql, int commandTimeout, bool useTransaction, string database )
true
the query is executed in a transaction.namespace Dynamicweb.Examples.CSharp { class DatabaseExecute { public void ExecuteSample() { //ExecuteScalar var pageCount = Input.FormatInteger(Database.ExecuteScalar("SELECT COUNT(PageID) FROM Page")); //ExecuteScalar on alternate database var userCount = Input.FormatInteger(Database.ExecuteScalar("SELECT COUNT(AccessUserID) FROM AccessUser")); //ExecuteNonQuery var numberOfPagesDeleted = Database.ExecuteNonQuery("DELETE FROM Page WHERE PageID < 101"); //ExecuteNonQuery on alternate database var numberOfUsersDeleted = Database.ExecuteNonQuery("DELETE FROM AccessUser WHERE AccessUserID < 101", "Access.mdb"); } } }
Public Class DatabaseExecute Public Sub ExecuteSample() 'ExecuteScalar Dim pageCount As Integer = Input.FormatInteger(Database.ExecuteScalar("SELECT COUNT(PageID) FROM Page")) 'ExecuteScalar on alternate database Dim userCount As Integer = Input.FormatInteger(Database.ExecuteScalar("SELECT COUNT(AccessUserID) FROM AccessUser")) 'ExecuteNonQuery Dim numberOfPagesDeleted As Integer = Database.ExecuteNonQuery("DELETE FROM Page WHERE PageID < 101") 'ExecuteNonQuery on alternate database Dim numberOfUsersDeleted As Integer = Database.ExecuteNonQuery("DELETE FROM AccessUser WHERE AccessUserID < 101", "Access.mdb") End Sub End Class
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