Setting Parameter Values on a Built (Compiled) Statement

Topics: Tips and Techniques
Coordinator
Aug 31, 2006 at 4:41 PM
Edited Jul 2, 2008 at 3:37 PM
private void btSave_Click(object sender, EventArgs e)
{
    string sql = "delete from Tracker where User='" + TrackingMeMain.Login + "'";
    jordb.Delete del = new jordb.Delete("C:\\jordb", sql);
    del.build();
    del.execute();

    int order = 1;
    long id = new java.util.Date().getTime();
    foreach (ListViewItem lvi in lvTrackers.Items)
    {

        Tracker t = (Tracker) lvi.Tag;
        if (t.ID == 0)
            t.ID = id;

        jordb.Insert ins = null;
        if (order==1)
        {
            sql = "insert into Tracker (ID,Name,NeededBackground,CollectedBackground,UOM,Order,User) values (" +
            t.ID.ToString() + ",'tname','name1', 'name2','" + t.UOM + "', " + order + ",'" + TrackingMeMain.Login + "')";

            ins = new jordb.Insert("C:\\jordb", sql);
            ins.build();
        }
        ins.setValue(1, t.TrackerName);
        ins.setValue(2, t.NeededName);
        ins.setValue(3, t.FullfilledName);
        ins.execute();

        order++;
        id = id + 1;
    }
}