Login  
Search All Forums
Dart Home | C++ Professional Toolkit | Custom Development Reply | C++ Professional Toolkit Topics | Forums   
AuthorForum: C++ Professional Toolkit
Topic: SNMP - How to get items from Table Row?
phtoan

From: HANOI, WA Vietnam
Posts: 1
Member Since: 12/21/03
posted December 21, 2003 11:29 PM

Here is my code in VC++, but it still doesn't work!

CString Oid,strOid;
char Result[255];
DartSnmp::ISnmpVariablesPtr Variables = pManager->Message->Variables;
  DartSnmp::ISnmpVariablesPtr MibVars = pManager->Mib->Variables;
DartSnmp::ISnmpVariablePtr Variable;
DartSnmp::ISnmpTableRowPtr TableRow;
DartSnmp::ISnmpTablePtr Table;

if(txtQuery.GetWindowTextLength() == 0)
  {
  ShowErrorMessage("Enter variable name");
return;
  }
  
  
CString strQuery;
txtQuery.GetWindowText(strQuery);
txtOIDqry.SetWindowText(Oid);


pManager->Message->Reset();
  AddVariable(strQuery);
//Variable = Variables->GetNext(_bsrt_t(strQuery));
//AddVariable(Variable);
pManager->Send();

Oid = (char *)MibVars->GetOIDFromName(_bstr_t(strQuery));

//Table = Variables->GetTable(_bstr_t(Oid));
//strOid = Oid + ".1";
TableRow = Variables->GetTableRow(_bstr_t(Oid));

COleVariant vi;
vi.vt = VT_INT;
vi.iVal = 5;
try{
Variable = TableRow->Item(vi);//Some problem is here
}catch(_com_error e)
{
ShowErrorMessage(e.HelpContext(), (char *)e.Description());  
}
strOid = Oid;
Oid += ".0";
if (strcmp(Oid,".0")==0){ShowErrorMessage("Truy van nay khong co trong csdl");}
else {
txtOIDqry.SetWindowText(Oid);

txtResult.SetWindowText(Variables->Item((COleVariant)Oid)->Value);
//sprintf(Result,"L:%s",TableRow->RowIndex);
//sprintf(Result,"L:%d",Variables->Item();
//txtCount.SetWindowText((CString) Result);
txtCount.SetWindowText(TableRow->RowIndex);
//txtCount.SetWindowText(Variable->Value);
if(txtResult.GetWindowTextLength() == 0)
  {
  ShowErrorMessage("Not found any value!");
return;
  }

UpdateData(FALSE);
}
//ReadTabe();
//ShowErrorMessage((char *)(Variables->Item((COleVariant)Oid)->Value));


Could anyone help me or give me example code, plzzz.
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted December 22, 2003 8:53 AM

I think you posted this in the wromg forum. You appear to be using the SNMP Tool, not PowerTCP Pro. That being the case, the sample agent and manager both have excellent examples of how to manipulate tables.

Reply | C++ Professional Toolkit Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX