'Declaration Public Shadows ReadOnly Property Parameters As SQLiteParameterCollection
public new SQLiteParameterCollection Parameters {get;}
'Declaration Public Shadows ReadOnly Property Parameters As SQLiteParameterCollection
public new SQLiteParameterCollection Parameters {get;}
static void CreateCommand(SQLiteConnection sqConnection, string mySelectQuery, SQLiteParameter[] myParamArray) { SQLiteCommand sqCommand = new SQLiteCommand(mySelectQuery, sqConnection); string myMessage = ""; for (int i = 0; i < myParamArray.Length; i++) { sqCommand.Parameters.Add(myParamArray[i]); myMessage += sqCommand.Parameters[i].ToString() + "\n"; } Console.Write(myMessage); try { sqConnection.Open(); sqCommand.ExecuteNonQuery(); } finally { sqConnection.Close(); } } static void Main(string[] args) { SQLiteParameter[] myParams = new SQLiteParameter[] { new SQLiteParameter("DeptNo", 10), new SQLiteParameter("DName", "COUNTING") }; SQLiteConnection sqConnection1 = new SQLiteConnection( "DataSource=mydatabase.db;"); CreateCommand(sqConnection1,"UPDATE Dept SET DName = :DName WHERE DeptNo = :DeptNo",myParams); }
Public Sub CreateCommand(ByVal sqConnection As Devart.Data.SQLite.SQLiteConnection, _ ByVal mySelectQuery As String, ByVal myParamArray() As Devart.Data.SQLite.SQLiteParameter) Dim sqCommand As New Devart.Data.SQLite.SQLiteCommand(mySelectQuery, sqConnection) Dim myMessage As String = "" Dim i As Integer For i = 0 To (myParamArray.Length - 1) sqCommand.Parameters.Add(myParamArray(i)) myMessage = String.Concat(myMessage, " ", sqCommand.Parameters(i).ToString()) Next Console.WriteLine(myMessage) Try sqConnection.Open() sqCommand.ExecuteNonQuery() Finally sqConnection.Close() End Try End Sub Sub Main() Dim myP1 As New Devart.Data.SQLite.SQLiteParameter myP1.ParameterName = "DeptNo" myP1.Value = 10 Dim myP2 As New Devart.Data.SQLite.SQLiteParameter myP2.ParameterName = "DName" myP2.Value = "ACCOUNTING" Dim myParams(1) As Devart.Data.SQLite.SQLiteParameter myParams(0) = myP1 myParams(1) = myP2 Dim sqConnection1 As New Devart.Data.SQLite.SQLiteConnection( _ "DataSource=mydatabase.db;") CreateCommand(sqConnection1, "UPDATE Dept SET DName = :DName WHERE DeptNo = :DeptNo", myParams) 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