Using DbLite from C#

Topics: Tips and Techniques
Coordinator
Aug 30, 2006 at 4:41 AM
Reference DbLite and vjslib

private void RefreshDiaryEntries()
{
lvDiaryEntries.Items.Clear();

string fromdt = "'" + calDay.SelectionStart.Month + "/";
fromdt = fromdt + calDay.SelectionStart.Day + "/";
fromdt = fromdt + calDay.SelectionStart.Year + "'";

DateTime enddt = calDay.SelectionEnd.AddDays(1);
string todt = "'" + enddt.Month + "/";
todt = todt + enddt.Day + "/";
todt = todt + enddt.Year + "'";

string sql = "select * from Diary where User = '" + Login + "' and TimeStamp >= " + fromdt + " and TimeStamp < " + todt;
jordb.Select DiaryEntries = new Select("c:\\jordb",sql);
DiaryEntries.build();
RecordSet rs = DiaryEntries.getRecordSet();

while (rs.moveNext())
{
string subject = (string) rs.get(rs.columnIndex("Diary.Subject"));
ListViewItem lvi = new ListViewItem(subject);

java.util.Date tsdate = (java.util.Date) rs.get(rs.columnIndex("Diary.TimeStamp"));
java.util.Date ludate = (java.util.Date)rs.get(rs.columnIndex("Diary.LastUpdate"));

lvi.SubItems.Add(ludate.ToString());
lvi.SubItems.Add(tsdate.ToString());
lvi.Tag = rs.get(rs.columnIndex("Diary.ID")).ToString();
lvi.ToolTipText = (string) rs.get(rs.columnIndex("Diary.Subject"));
lvDiaryEntries.Items.Add(lvi);
}
}