So, basically what I'm doing is logging into a lotus notes database and pulling some information. however it's not releasing the objects after I'm done. this is causing issues. if I run this code wait until it's done and then go check names.nsf it will still be in use no matter what I try. hopefully SO master coders can help me out :) thanks!
NotesSession ns = new NotesSession();
NotesDatabase ndb;
NotesView nview;
NotesDocument doc;
try
{
ns.Initialize();
ndb = ns.GetDatabase("server", @"database",false);
nview = ndb.GetView(@"view");
doc = nview.GetFirstDocument();
ListViewItem notesrow = new ListViewItem();
while (doc != null)
{
notesrow = new ListViewItem();
if (doc.HasItem("variable0") && doc.HasItem("variable1") && doc.HasItem("variable2") && doc.GetFirstItem("Remark").Text.ToLower().Contains(modules.CheckUser().ToLower().ToString()))
{
string remark = doc.GetFirstItem("variable0").Text;
string ticket = doc.GetFirstItem("variable1").Text;
string workstation = doc.GetFirstItem("variable2").Text;
notesrow.Text = ticket.ToString().ToUpper();
notesrow.SubItems.Add(workstation);
notesrow.SubItems.Add("");
ListView lv = this.notesDBInfo1.listView1;
lv.Items.Add(notesrow);
}
doc = nview.GetNextDocument(doc);
}
//added these because of some other code i read. they dont appear to help me here
Marshal.ReleaseComObject(nview);
Marshal.ReleaseComObject(ndb);
Marshal.ReleaseComObject(ns);
//the ibm documentation sets the variables to "nothing" because it's VB so i set to null.. still holds the connection.
ns = null;
ndb = null;
nview = null;
doc = null;