I am interested in dumping some results from a collection I have into a group
of variables. I have a counter that loops but I don't know how to use the
counter to determine my variable names.
Here is my code...
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Namespace CiscoSwitch
Public Class SwitchInterfaces
Public SwitchPort1 As String
Public SwitchPort2 As String
Public SwitchPort3 As String
Public SwitchPort4 As String
Public SwitchPort5 As String
Public SwitchPort6 As String
Public SwitchPort7 As String
Public SwitchPort8 As String
Public SwitchPort9 As String
Public SwitchPort10 As String
Public SwitchPort11 As String
Public SwitchPort12 As String
Public SwitchPort13 As String
Public SwitchPort14 As String
Public SwitchPort15 As String
Public SwitchPort16 As String
Public SwitchPort17 As String
Public SwitchPort18 As String
Public SwitchPort19 As String
Public SwitchPort20 As String
Public SwitchPort21 As String
Public SwitchPort22 As String
Public SwitchPort23 As String
Public SwitchPort24 As String
End Class
End Namespace
<WebService(Description:="Status of Switch Interfaces ONLY ",
Namespace:="http://10.33.32.158/CoinsEngineV1")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicPr ofile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.Des ignerGenerated()> _
Public Class Service
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function Get3750InterfaceInfo() As CiscoSwitch.SwitchInterfaces
Dim InterfaceStatus As New CiscoSwitch.SwitchInterfaces
Dim ArrayCounter As Integer = 0
Dim InterfaceInfo1(30) As String
InterfaceInfo1 = New String(30) {}
Dim InterfaceInfo2(30) As String
InterfaceInfo2 = New String(30) {}
Dim SNMPOutput As String = ""
Dim SNMPTargetDevice As String = "192.168.0.100"
Dim SNMPCommunityString As String = "public"
Dim WMILocator As Object = CreateObject("WBemScripting.SWBemLocator")
Dim WMIServices As Object = WMILocator.ConnectServer("",
"root\snmp\localhost")
Dim WMINamedValueSet As Object =
CreateObject("WBemScripting.SWBemNamedValueSet")
WMINamedValueSet.Add("AgentAddress", SNMPTargetDevice)
WMINamedValueSet.Add("AgentReadCommunityName", SNMPCommunityString)
'Dim colSystem = WMIServices.InstancesOf("SNMP_RFC1213_MIB_system",
, WMINamedValueSet)
Dim colSystem = WMIServices.InstancesOf("SNMP_RFC1213_MIB_ifTable" ,
, WMINamedValueSet)
Try
For Each objSystem As Object In colSystem
InterfaceStatus.SwitchPort.CStr(ArrayCounter) =
objSystem.IfOperStatus
ArrayCounter = ArrayCounter + 1
Next
Catch ex As Exception
SNMPOutput = "There is some kind of problem..."
End Try
Return InterfaceStatus
End Function 2 2514
Why not make Switchport an array instead (Public SwitchPort(24) as String)?
"Military Smurf" <Mi***********@discussions.microsoft.com> wrote in message
news:26**********************************@microsof t.com... I am interested in dumping some results from a collection I have into a group of variables. I have a counter that loops but I don't know how to use the counter to determine my variable names.
Here is my code... Imports System.Web Imports System.Web.Services Imports System.Web.Services.Protocols
Namespace CiscoSwitch Public Class SwitchInterfaces Public SwitchPort1 As String Public SwitchPort2 As String Public SwitchPort3 As String Public SwitchPort4 As String Public SwitchPort5 As String Public SwitchPort6 As String Public SwitchPort7 As String Public SwitchPort8 As String Public SwitchPort9 As String Public SwitchPort10 As String Public SwitchPort11 As String Public SwitchPort12 As String Public SwitchPort13 As String Public SwitchPort14 As String Public SwitchPort15 As String Public SwitchPort16 As String Public SwitchPort17 As String Public SwitchPort18 As String Public SwitchPort19 As String Public SwitchPort20 As String Public SwitchPort21 As String Public SwitchPort22 As String Public SwitchPort23 As String Public SwitchPort24 As String End Class End Namespace
<WebService(Description:="Status of Switch Interfaces ONLY ", Namespace:="http://10.33.32.158/CoinsEngineV1")> _ <WebServiceBinding(ConformsTo:=WsiProfiles.BasicPr ofile1_1)> _ <Global.Microsoft.VisualBasic.CompilerServices.Des ignerGenerated()> _ Public Class Service Inherits System.Web.Services.WebService
<WebMethod()> _ Public Function Get3750InterfaceInfo() As CiscoSwitch.SwitchInterfaces Dim InterfaceStatus As New CiscoSwitch.SwitchInterfaces Dim ArrayCounter As Integer = 0
Dim InterfaceInfo1(30) As String InterfaceInfo1 = New String(30) {} Dim InterfaceInfo2(30) As String InterfaceInfo2 = New String(30) {}
Dim SNMPOutput As String = "" Dim SNMPTargetDevice As String = "192.168.0.100" Dim SNMPCommunityString As String = "public" Dim WMILocator As Object = CreateObject("WBemScripting.SWBemLocator") Dim WMIServices As Object = WMILocator.ConnectServer("", "root\snmp\localhost") Dim WMINamedValueSet As Object = CreateObject("WBemScripting.SWBemNamedValueSet") WMINamedValueSet.Add("AgentAddress", SNMPTargetDevice) WMINamedValueSet.Add("AgentReadCommunityName", SNMPCommunityString) 'Dim colSystem = WMIServices.InstancesOf("SNMP_RFC1213_MIB_system", , WMINamedValueSet) Dim colSystem = WMIServices.InstancesOf("SNMP_RFC1213_MIB_ifTable" , , WMINamedValueSet) Try For Each objSystem As Object In colSystem InterfaceStatus.SwitchPort.CStr(ArrayCounter) = objSystem.IfOperStatus ArrayCounter = ArrayCounter + 1 Next Catch ex As Exception SNMPOutput = "There is some kind of problem..." End Try Return InterfaceStatus
End Function
I tried that first-but, this is going into an Adobe Flash front end over a
web service. Based on my Flash code, each element in the XML file must have
a unique tag, such as:
InterfaceStatus.SwitchPort1 = "up"
InterfaceStatus.SwitchPort2 = "down"
Then the Flash front end can handle the variable values-as an array, it
simply says "object."
"Jason" wrote: Why not make Switchport an array instead (Public SwitchPort(24) as String)? "Military Smurf" <Mi***********@discussions.microsoft.com> wrote in message news:26**********************************@microsof t.com...I am interested in dumping some results from a collection I have into a group of variables. I have a counter that loops but I don't know how to use the counter to determine my variable names.
Here is my code... Imports System.Web Imports System.Web.Services Imports System.Web.Services.Protocols
Namespace CiscoSwitch Public Class SwitchInterfaces Public SwitchPort1 As String Public SwitchPort2 As String Public SwitchPort3 As String Public SwitchPort4 As String Public SwitchPort5 As String Public SwitchPort6 As String Public SwitchPort7 As String Public SwitchPort8 As String Public SwitchPort9 As String Public SwitchPort10 As String Public SwitchPort11 As String Public SwitchPort12 As String Public SwitchPort13 As String Public SwitchPort14 As String Public SwitchPort15 As String Public SwitchPort16 As String Public SwitchPort17 As String Public SwitchPort18 As String Public SwitchPort19 As String Public SwitchPort20 As String Public SwitchPort21 As String Public SwitchPort22 As String Public SwitchPort23 As String Public SwitchPort24 As String End Class End Namespace
<WebService(Description:="Status of Switch Interfaces ONLY ", Namespace:="http://10.33.32.158/CoinsEngineV1")> _ <WebServiceBinding(ConformsTo:=WsiProfiles.BasicPr ofile1_1)> _ <Global.Microsoft.VisualBasic.CompilerServices.Des ignerGenerated()> _ Public Class Service Inherits System.Web.Services.WebService
<WebMethod()> _ Public Function Get3750InterfaceInfo() As CiscoSwitch.SwitchInterfaces Dim InterfaceStatus As New CiscoSwitch.SwitchInterfaces Dim ArrayCounter As Integer = 0
Dim InterfaceInfo1(30) As String InterfaceInfo1 = New String(30) {} Dim InterfaceInfo2(30) As String InterfaceInfo2 = New String(30) {}
Dim SNMPOutput As String = "" Dim SNMPTargetDevice As String = "192.168.0.100" Dim SNMPCommunityString As String = "public" Dim WMILocator As Object = CreateObject("WBemScripting.SWBemLocator") Dim WMIServices As Object = WMILocator.ConnectServer("", "root\snmp\localhost") Dim WMINamedValueSet As Object = CreateObject("WBemScripting.SWBemNamedValueSet") WMINamedValueSet.Add("AgentAddress", SNMPTargetDevice) WMINamedValueSet.Add("AgentReadCommunityName", SNMPCommunityString) 'Dim colSystem = WMIServices.InstancesOf("SNMP_RFC1213_MIB_system", , WMINamedValueSet) Dim colSystem = WMIServices.InstancesOf("SNMP_RFC1213_MIB_ifTable" , , WMINamedValueSet) Try For Each objSystem As Object In colSystem InterfaceStatus.SwitchPort.CStr(ArrayCounter) = objSystem.IfOperStatus ArrayCounter = ArrayCounter + 1 Next Catch ex As Exception SNMPOutput = "There is some kind of problem..." End Try Return InterfaceStatus
End Function This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: johnb41 |
last post by:
I've searched Google for how to make an element "Auto Increment":
<xs:element name="id" minOccurs="0" msdata:AutoIncrement="true"
type="xs:integer" />
It's not working! Here is simplified...
|
by: A |
last post by:
Hi
the .column..... autoincrement line gives a fault :: Item cannot be found in
the collection corresponding to the requested name or ordinal error number
3265.
Must I move the line ?
Thanks...
|
by: Neil |
last post by:
Hi,
I'm getting some strange results using the autoincrement column on my
datatable. I'm populating a datatable with data from my database and
displaying this in a datagrid. The first time I get...
|
by: Dennis |
last post by:
I have set a DataTable and one of the columns I set "AutoIncrement" to True.
I then populate the Table by setting the columns to values then add the row
to the table. I inadverently set the...
|
by: Michael |
last post by:
I am trying to create an access database within Net 2003 using the ADOX
library which works fine except when I try to add the AutoIncrement property
to the ContactId column.
I am experiencing a...
|
by: MP |
last post by:
context: vb6/ ado / .mdb format / jet 4.0 (not using Access - ADO only)
- creating tables via ADO (don't have access)
- all tables have a primary key (PK)
- many of the PK will become FK(Foreign...
|
by: Mike |
last post by:
I have a form that has an embedded subform (Datasheet View) that are
linked based on a 1-many ID field. I have a field (SET) in my embedded
subform that I want to Autoincrement starting with...
|
by: Grzes_P |
last post by:
J have database DB2 and create table T_TEST with fields:
ID - integer autoincrement
NAME - varchar(50)
QTY - Integer
I create java bean CMP and install it on Jboss server and when create new...
|
by: Tim |
last post by:
Hello All, I could use some help on an error that is just now popping it's
head up.
Seems that the autoincrement numeric has hit 32,767. The autoincrement is
used in various locations in the...
|
by: Csaba Gabor |
last post by:
Is there any way to detect, based strictly on querying the
structure of a table/database whether there is an
AUTOINCREMENT set? That is to say, without analyzing
the original SQL creation...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |