command class : Add(string,string) method

Description

Sets a value for the parameter.

Syntax

instance.Add(string name, string value)

Arguments

ClassNameDescription
stringnameName.
stringvalueValue.

Return value

None.

Sample code

1:

connection cnn = new connection("Data Source=c:\somedirectory\somedatabase.sqlite3;Version=3;");

2:

cnn.Open();

3:

command cmm = new command("create table sometable (id int, name text);", cnn);

4:

cmm.NonQuery(); // Creates the "sometable".

5:

cmm.CommandText = "insert into sometable values(@id, @name);";

6:

cmm.Add("@id", 1); // Sets 1 to the "@id".

7:

cmm.Add("@name", "name string"); // Sets "name string" to the "@name".

8:

cmm.NonQuery(); // Data inserting is done.

9:

cmm.Release();

10:

cnn.Close();

11:

cnn.Release();

Notes

None.

Links for reference

None.

Copyright © Cooker All rights reserved.