// read list of catalog entries for the given catalog private void PopulateMembers(string lib, string cat) { Cursor c = Cursor.Current; Cursor.Current = Cursors.WaitCursor; lvMembers.BeginUpdate(); lvMembers.Items.Clear(); SAS.Workspace ws = null; try { ws = consumer.Workspace(currentServer) as SAS.Workspace; } catch (Exception ex) { throw new System.Exception("ISASTaskConsumer.Workspace is not usable!", ex); } if (currentServer.Length > 0 && ws != null) { // use the SAS IOM OLEDB provider to read data from the SAS workspace ADODB.Recordset adorecordset = new ADODB.RecordsetClass(); ADODB.Connection adoconnect = new ADODB.ConnectionClass(); try { adoconnect.Open("Provider=sas.iomprovider.1; SAS Workspace ID=" + ws.UniqueIdentifier, "", "", 0); // use the SASHELP.VCATALG view to get all of the catalog entries in the specified library/catalog string selectclause = "select * from sashelp.vcatalg where libname='" + lib + "' and memname = '" + cat + "'"; adorecordset.Open(selectclause, adoconnect, ADODB.CursorTypeEnum.adOpenForwardOnly, ADODB.LockTypeEnum.adLockReadOnly, (int)ADODB.CommandTypeEnum.adCmdText); while (!adorecordset.EOF) { ListViewItem lvi = new ListViewItem(); lvi.Text = adorecordset.Fields["objname"].Value.ToString(); lvi.SubItems.Add(adorecordset.Fields["objtype"].Value.ToString()); lvi.SubItems.Add(adorecordset.Fields["objdesc"].Value.ToString()); lvi.SubItems.Add(ConvertSASDate(adorecordset.Fields["created"].Value.ToString())); lvi.SubItems.Add(ConvertSASDate(adorecordset.Fields["modified"].Value.ToString())); lvi.ImageIndex = GetImageIndexForEntry(adorecordset.Fields["objtype"].Value.ToString()); lvi.Tag = string.Format("{0}.{1}.{2}.{3}", lib, cat, lvi.Text, adorecordset.Fields["objtype"].Value.ToString()); lvMembers.Items.Add(lvi); adorecordset.MoveNext(); } } catch {} finally { adoconnect.Close(); } } lvMembers.EndUpdate(); Cursor.Current = c; UpdateToolbar(); }
// read list of catalogs for the given library (in the tree node) private void PopulateCatalogs(TreeNode tn) { Cursor c = Cursor.Current; Cursor.Current = Cursors.WaitCursor; tvLibsCats.BeginUpdate(); if (tn != null) { SAS.Workspace ws = null; try { ws = consumer.Workspace(currentServer) as SAS.Workspace; } catch (Exception ex) { throw new System.Exception("ISASTaskConsumer.Workspace is not usable!", ex); } if (currentServer.Length > 0 && ws != null) { // use the SAS IOM OLEDB provider to read data from the SAS workspace ADODB.Recordset adorecordset = new ADODB.RecordsetClass(); ADODB.Connection adoconnect = new ADODB.ConnectionClass(); try { adoconnect.Open("Provider=sas.iomprovider.1; SAS Workspace ID=" + ws.UniqueIdentifier, "", "", 0); // use the SASHELP.VMEMBER view to get names of all of the catalogs in the specified library string selectclause = "select memname from sashelp.vmember where libname='" + tn.Text + "' and memtype in ('CATALOG')"; adorecordset.Open(selectclause, adoconnect, ADODB.CursorTypeEnum.adOpenForwardOnly, ADODB.LockTypeEnum.adLockReadOnly, (int)ADODB.CommandTypeEnum.adCmdText); while (!adorecordset.EOF) { TreeNode cat = tn.Nodes.Add(adorecordset.Fields["memname"].Value.ToString()); cat.ImageIndex = (int)CatImages.Catalog; cat.SelectedImageIndex = (int)CatImages.Catalog; cat.Tag = "CATALOG"; adorecordset.MoveNext(); } } catch {} finally { adoconnect.Close(); } } } tvLibsCats.EndUpdate(); Cursor.Current = c; UpdateToolbar(); }
// read list of catalog entries for the given catalog private void PopulateMembers(string lib, string cat) { Cursor c = Cursor.Current; Cursor.Current = Cursors.WaitCursor; lvMembers.BeginUpdate(); lvMembers.Items.Clear(); SAS.Workspace ws = null; try { ws = consumer.Workspace(currentServer) as SAS.Workspace; } catch (Exception ex) { throw new System.Exception("ISASTaskConsumer.Workspace is not usable!",ex); } if (currentServer.Length>0 && ws!=null) { // use the SAS IOM OLEDB provider to read data from the SAS workspace ADODB.Recordset adorecordset = new ADODB.RecordsetClass(); ADODB.Connection adoconnect = new ADODB.ConnectionClass(); try { adoconnect.Open("Provider=sas.iomprovider.1; SAS Workspace ID=" + ws.UniqueIdentifier, "", "", 0); // use the SASHELP.VCATALG view to get all of the catalog entries in the specified library/catalog string selectclause = "select * from sashelp.vcatalg where libname='" + lib + "' and memname = '" + cat + "'"; adorecordset.Open( selectclause, adoconnect, ADODB.CursorTypeEnum.adOpenForwardOnly, ADODB.LockTypeEnum.adLockReadOnly, (int) ADODB.CommandTypeEnum.adCmdText); while (!adorecordset.EOF) { ListViewItem lvi = new ListViewItem(); lvi.Text = adorecordset.Fields["objname"].Value.ToString(); lvi.SubItems.Add(adorecordset.Fields["objtype"].Value.ToString()); lvi.SubItems.Add(adorecordset.Fields["objdesc"].Value.ToString()); lvi.SubItems.Add(ConvertSASDate(adorecordset.Fields["created"].Value.ToString())); lvi.SubItems.Add(ConvertSASDate(adorecordset.Fields["modified"].Value.ToString())); lvi.ImageIndex = GetImageIndexForEntry(adorecordset.Fields["objtype"].Value.ToString()); lvi.Tag = string.Format("{0}.{1}.{2}.{3}", lib, cat, lvi.Text, adorecordset.Fields["objtype"].Value.ToString()); lvMembers.Items.Add(lvi); adorecordset.MoveNext(); } } catch {} finally { adoconnect.Close(); } } lvMembers.EndUpdate(); Cursor.Current = c; UpdateToolbar(); }
// read list of catalogs for the given library (in the tree node) private void PopulateCatalogs(TreeNode tn) { Cursor c = Cursor.Current; Cursor.Current = Cursors.WaitCursor; tvLibsCats.BeginUpdate(); if (tn!=null) { SAS.Workspace ws = null; try { ws = consumer.Workspace(currentServer) as SAS.Workspace; } catch (Exception ex) { throw new System.Exception("ISASTaskConsumer.Workspace is not usable!",ex); } if (currentServer.Length>0 && ws!=null) { // use the SAS IOM OLEDB provider to read data from the SAS workspace ADODB.Recordset adorecordset = new ADODB.RecordsetClass(); ADODB.Connection adoconnect = new ADODB.ConnectionClass(); try { adoconnect.Open("Provider=sas.iomprovider.1; SAS Workspace ID=" + ws.UniqueIdentifier, "", "", 0); // use the SASHELP.VMEMBER view to get names of all of the catalogs in the specified library string selectclause = "select memname from sashelp.vmember where libname='" + tn.Text + "' and memtype in ('CATALOG')"; adorecordset.Open( selectclause, adoconnect, ADODB.CursorTypeEnum.adOpenForwardOnly, ADODB.LockTypeEnum.adLockReadOnly, (int) ADODB.CommandTypeEnum.adCmdText); while (!adorecordset.EOF) { TreeNode cat = tn.Nodes.Add(adorecordset.Fields["memname"].Value.ToString()); cat.ImageIndex = (int)CatImages.Catalog; cat.SelectedImageIndex = (int)CatImages.Catalog; cat.Tag = "CATALOG"; adorecordset.MoveNext(); } } catch {} finally { adoconnect.Close(); } } } tvLibsCats.EndUpdate(); Cursor.Current = c; UpdateToolbar(); }