Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get uniqe ID to use in next table

Status
Not open for further replies.

slint

Technical User
Jul 2, 2006
48
SE
I'm trying to get the hold of the uniqe IDnr compID from table inventTB to insert in the table inventNIC but i cant seam to get it right.

Can anyone point me in the right direction...


Code:
'On Error Resume Next

Set oShell = CreateObject("wscript.Shell")
Set env = oShell.environment("Process")


    Set objNetwork = CreateObject("WScript.Network")
    strComputer = objNetwork.ComputerName

Set objConn = CreateObject("ADODB.Connection")
Set objRS = CreateObject("ADODB.Recordset")

objConn.Open "DSN=inventcon;"
objRS.CursorLocation = 3
objRS.Open "SELECT * FROM inventTB" , objConn, 3, 3


Const HKEY_LOCAL_MACHINE = &H80000002
Const UnInstPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer &"\root\default:StdRegProv")

Set objWMIService = GetObject("winmgmts:\\" & strComputer &"\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)

For Each objItem in colItems
    objRS.AddNew
    objRS("Caption") = objItem.Caption
    objRS("Description") = objItem.Description
    objRS("InstallDate") = objItem.InstallDate
    objRS("Organization") = objItem.Organization
    objRS("OSProductSuite") = objItem.OSProductSuite
    objRS("RegisteredUser") = objItem.RegisteredUser
    objRS("ServicePackMajorVersion") = objItem.ServicePackMajorVersion
    objRS("ServicePackMinorVersion") = objItem.ServicePackMinorVersion
    objRS("Version") = objItem.Version
    objRS("WindowsDirectory") = objItem.WindowsDirectory
    
    objRS.Update

Next


Set colSMBIOS = objWMIService.ExecQuery ("Select * from Win32_SystemEnclosure")
For Each objSMBIOS in colSMBIOS
    objRS("SerialNumber") = objSMBIOS.SerialNumber 
    objRS.Update
next


Set colCOMpn = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)
For Each objCOMpn in colCOMpn
    objRS("Manufacturer") = objCOMpn.Manufacturer
    objRS("Model") = objCOMpn.Model
    objRS("UserName") = objCOMpn.UserName
    objRS("ComputerName") = strComputer
    objRS("Name") = objCOMpn.Name
    objRS.Update
next   
   
   
   
Function WMIDateStringToDate(utcDate)
   WMIDateStringToDate = CDate(Mid(utcDate, 5, 2)  & "/" & _
       Mid(utcDate, 7, 2)  & "/" & _
           Left(utcDate, 4)    & " " & _
               Mid (utcDate, 9, 2) & ":" & _
                   Mid(utcDate, 11, 2) & ":" & _
                      Mid(utcDate, 13, 2))
End Function
 
[COLOR=red]

 objRS.close
Set objRS = CreateObject("ADODB.Recordset")
objRS.Open "SELECT compID FROM inventTB WHERE ComputerName = "& strComputer , objConn, 3, 3
 
   compIDnr = compID


[/color]

objRS.close
Set objRS = CreateObject("ADODB.Recordset")
objRS.Open "SELECT * FROM inventNIC" , objConn, 3, 3

    
Set colAdapters = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")

     n = 1
[COLOR=red]
   For Each objAdapter in colAdapters
   objRS.AddNew
    objRS("compID") = compIDnr
    objRS("Description") = objAdapter.Description
    objRS("MACAddress") = objAdapter.MACAddress
    objRS("DNSHostName") = objAdapter.DNSHostName
    [/color]
   If Not IsNull(objAdapter.IPAddress) Then
      For i = 0 To UBound(objAdapter.IPAddress)
    objRS("IPAddress") = objAdapter.IPAddress(i)
      Next
   End If

   If Not IsNull(objAdapter.IPSubnet) Then
      For i = 0 To UBound(objAdapter.IPSubnet)
    objRS("IPSubnet") = objAdapter.IPSubnet(i)
      Next
   End If
 
   If Not IsNull(objAdapter.DefaultIPGateway) Then
      For i = 0 To UBound(objAdapter.DefaultIPGateway)
    objRS("DefaultIPGateway") = objAdapter.DefaultIPGateway(i) 
     Next
   End If
 
   If Not IsNull(objAdapter.DNSServerSearchOrder) Then
      For i = 0 To UBound(objAdapter.DNSServerSearchOrder)
    objRS("DNSServerSearchOrder") = objAdapter.DNSServerSearchOrder(i) 
      Next
   End If
    
    objRS("DNSDomain") = objAdapter.DNSDomain(i) 

   If Not IsNull(objAdapter.DNSDomainSuffixSearchOrder) Then
      For i = 0 To UBound(objAdapter.DNSDomainSuffixSearchOrder)
    objRS("DNSDomainSuffixSearchOrder") = objAdapter.DNSDomainSuffixSearchOrder(i) 
      Next
   End If
 
    objRS("DHCPEnabled") = objAdapter.DHCPEnabled 
    objRS("DHCPServer") = objAdapter.DHCPServer 

                         
    If Not IsNull(objAdapter.DHCPLeaseObtained) Then
        utcLeaseObtained = objAdapter.DHCPLeaseObtained & vbCrLf
        strLeaseObtained = WMIDateStringToDate(utcLeaseObtained)
    Else
        strLeaseObtained = ""
            End If
    objRS("strLeaseObtained") = strLeaseObtained 


    If Not IsNull(objAdapter.DHCPLeaseExpires) Then
        utcLeaseExpires = objAdapter.DHCPLeaseExpires & vbCrLf
        strLeaseExpires = WMIDateStringToDate(utcLeaseExpires)
    Else
        strLeaseExpires = ""
    End If
            
    objRS("strLeaseExpires") = strLeaseExpires 

    objRS("WINSPrimaryServer") = objAdapter.WINSPrimaryServer 
    objRS("WINSSecondaryServer") = objAdapter.WINSSecondaryServer 
objRS.Update 
 
         n = n + 1   

Next

objRS.Close

objConn.Close
 
I'd replace this:
compIDnr = compID
with this:
compIDnr = objRS("compID")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I tryed your suggestion but i'm getting an error on line 76:

error: Invalid column name 'My computername'
code: 80040E14

Any ide?
 
What is the code of line 76 ?
Which RDBMS is accessed by DSN=inventcon ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
db consist of two tables, one table named inventTB, containing columns corresponding to the first objRS command. It also contain a primary key, compID (datatype = int). The second table is named inventNIC and containes columns corresponding to the second objRS command. It also contains a column with the name compID (datatype = numric) and a primary key named nicID (datatype = int).

And the relation is "one to many", inventTB.compID <- 1 - oo -> inventNIC.compID

When i run the script i get an error telling me invalid column name and writes out my computer name.


Code:
           objRS.close
           Set objRS = CreateObject("ADODB.Recordset")
line 76 -> objRS.Open "SELECT compID FROM inventTB WHERE ComputerName = "& strComputer , objConn, 3, 3
 
           compIDnr = objRS("compID") 




           objRS.close
           Set objRS = CreateObject("ADODB.Recordset")
           objRS.Open "SELECT * FROM inventNIC" , objConn, 3, 3

    
          Set colAdapters = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")

     n = 1

   For Each objAdapter in colAdapters
   objRS.AddNew
    objRS("compID") = compIDnr
    objRS("Description") = objAdapter.Description
    objRS("MACAddress") = objAdapter.MACAddress
    objRS("DNSHostName") = objAdapter.DNSHostName


Visual description of db:

database name: inventDB

tables
inventTB inventNIC
compID (int) <-1--oo-> compID (numeric)
Caption (varchar 255) Description (varchar 255)
Description (varchar 255) MACAddress (varchar 255)
InstallDate (varchar 255) ...etc
Organization (varchar 255) ...etc
ComputerName (varchar 255)
...etc
...etc

 
Code:
objRS.Open "SELECT compID FROM inventTB WHERE ComputerName=[!]'[/!]" & strComputer [!]& "'"[/!], objConn, 3, 3

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Super PHV!

But.. there is always a but..

How do i update values in table inventTB and inventNIC rather then inserting new if i run the script two, tree or even more times. I dont want a new row in inventTB or inventNIC everytime i am running the script just updating the values when computername matches. If its the first time i run the script then it should insert values as it does.

some hints.

thanks!
 
I have tryed to do it by learning and i have come up with this... i'm i on the right track.. any suggestions..

Code:
'On Error Resume Next

Set oShell = CreateObject("wscript.Shell")
Set env = oShell.environment("Process")


    Set objNetwork = CreateObject("WScript.Network")
    strComputer = objNetwork.ComputerName

Set objConn = CreateObject("ADODB.Connection")
Set objRS = CreateObject("ADODB.Recordset")

objConn.Open "DSN=inventcon;"
objRS.CursorLocation = 3
objRS.Open "SELECT * FROM inventTB" , objConn, 3, 3


Const HKEY_LOCAL_MACHINE = &H80000002
Const UnInstPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer &"\root\default:StdRegProv")

Set objWMIService = GetObject("winmgmts:\\" & strComputer &"\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)

For Each objItem in colItems
    strCaption = objItem.Caption
    strDescription = objItem.Description
    strComputerName = strComputer
Next

Function insertSql(Caption,Description,ComputerName)
    strsql = "Insert into inventTB (Caption,Description,ComputerName) VALUES ('Caption = ' "& strCaption &" ', Description = ' "& strDescription &" ', ComputerName = ' "& strComputerName &"'"
    objconn.execute(strsql)
end function


Function updateSql(Caption,Description,ComputerName)
    strsql = "update compID set (Caption = ' "& strCaption &" ', Description = ' "& strDescription &" ', ComputerName = ' "& strComputerName &" ') WHERE ComputerName = "&strComputer &"'"
    objconn.Execute(strsql)
End Function
 
Use objRS.MoveFirst and objRS.Find to know which function (insertSQL or updateSQL) to execute.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
You mean something like this...


The script dosent give me any errors but there is no data writen to the database.

Code:
'On Error Resume Next

Set oShell = CreateObject("wscript.Shell")
Set env = oShell.environment("Process")


    Set objNetwork = CreateObject("WScript.Network")
    strComputer = objNetwork.ComputerName

Set objConn = CreateObject("ADODB.Connection")
Set objRS = CreateObject("ADODB.Recordset")

objConn.Open "DSN=inventcon;"
objRS.CursorLocation = 3
objRS.Open "SELECT * FROM inventTB" , objConn, 3, 3


Const HKEY_LOCAL_MACHINE = &H80000002
Const UnInstPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer &"\root\default:StdRegProv")

Set objWMIService = GetObject("winmgmts:\\" & strComputer &"\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)


objRS.Find strComputerName

If objRS.EOF Then

	Function insertSql(Caption,Description,ComputerName)
	    strsql = "Insert into inventTB (Caption,Description,ComputerName) VALUES ('Caption = ' "& strCaption &" ', Description = ' "& strDescription &" ', ComputerName = ' "& strComputerName &"'"
	    objconn.execute(strsql)
	end function

Else

	Function updateSql(Caption,Description,ComputerName)
	    strsql = "update compID set (Caption = ' "& strCaption &" ', Description = ' "& strDescription &" ', ComputerName = ' "& strComputerName &" ') WHERE ComputerName = "&strComputer &"'"
	    objconn.Execute(strsql)
	End Function

End If 

objRS.Close
Set objRS = Nothing
 
Code:
objRS.Find "ComputerName='" & strComputer & "'"
If objRS.EOF Then
  strsql = "Insert into inventTB (Caption,Description,ComputerName) VALUES ('" & strCaption & "','" & strDescription & "','" & strComputer & "'"
Else
  strsql = "update inventTB set Caption=' " & strCaption & "',Description='" & strDescription & "' WHERE ComputerName='" & strComputer & "'"
End If
objconn.Execute strsql

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Now when i am running the script it updates the values, greate. But it dosent insert new values. The error i get is: Incorrect syntax near 'MyComputername'

And the script stops at objconn.Execute strsql

Code:
'On Error Resume Next

Set oShell = CreateObject("wscript.Shell")
Set env = oShell.environment("Process")


    Set objNetwork = CreateObject("WScript.Network")
    strComputer = objNetwork.ComputerName

Set objConn = CreateObject("ADODB.Connection")
Set objRS = CreateObject("ADODB.Recordset")

objConn.Open "DSN=inventcon;"
objRS.CursorLocation = 3
objRS.Open "SELECT * FROM inventTB" , objConn, 3, 3

Const HKEY_LOCAL_MACHINE = &H80000002
Const UnInstPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer &"\root\default:StdRegProv")

Set objWMIService = GetObject("winmgmts:\\" & strComputer &"\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)

For Each objItem in colItems
    strCaption = objItem.Caption
    strDescription = objItem.Description
Next

objRS.Find "ComputerName='" & strComputer & "'"
If objRS.EOF Then
  strsql = "Insert into inventTB (Caption,Description,ComputerName) VALUES ('" & strCaption & "','" & strDescription & "','" & strComputer & "'"
Else
  strsql = "update inventTB set Caption=' " & strCaption & "',Description='" & strDescription & "' WHERE ComputerName='" & strComputer & "'"
End If
objconn.Execute strsql

objRS.Close
Set objRS = Nothing
 
Sorry for the typo:
strsql = "Insert into inventTB (Caption,Description,ComputerName) VALUES ('" & strCaption & "','" & strDescription & "','" & strComputer & "'[!])[/!]"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV you are entitled to do a typo! i'm the jackass that dosent se the typo. Once again thank you wery much!

I have come this far with my script.

The script run great it inserts values if the computername isnt there and it updates if it is. Super! A also added the same type of command for getting the Nic info. And even there it insert values based on compID nr from table inventTB. And it updates the values if compIDnr is in the table.

I only got one thing left..

For the inventNIC insertion and update i only get items for one adapter. For example: in my computer i got 4 nic interfaces but when i run the script it only inserts/updates values for the first nic not the other 3. So i'm guessing that somewhere i would put in the code:
Code:
     n = 1
For Each objAdapter in colAdapters

 Do the mighty insert update stuff...

  n = n + 1
     
     next

But exactly how i should do i dont know. And thats where you experts come in!

Thanks in advance!

Code:
'On Error Resume Next

Set oShell = CreateObject("wscript.Shell")
Set env = oShell.environment("Process")


    Set objNetwork = CreateObject("WScript.Network")
    strComputer = objNetwork.ComputerName

Set objConn = CreateObject("ADODB.Connection")
Set objRS = CreateObject("ADODB.Recordset")

objConn.Open "DSN=inventcon;"
objRS.CursorLocation = 3
objRS.Open "SELECT * FROM inventTB" , objConn, 3, 3

Function WMIDateStringToDate(utcDate)
   WMIDateStringToDate = CDate(Mid(utcDate, 5, 2)  & "/" & _
       Mid(utcDate, 7, 2)  & "/" & _
           Left(utcDate, 4)    & " " & _
               Mid (utcDate, 9, 2) & ":" & _
                   Mid(utcDate, 11, 2) & ":" & _
                      Mid(utcDate, 13, 2))
End Function

Const HKEY_LOCAL_MACHINE = &H80000002
Const UnInstPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer &"\root\default:StdRegProv")

Set objWMIService = GetObject("winmgmts:\\" & strComputer &"\root\cimv2")

' ******************Get the data to update or insert into inventTB table***************************

Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)

For Each objItem in colItems
    strCaption = objItem.Caption
    strDescription = objItem.Description
	strInstallDate = objItem.InstallDate
    strOrganization = objItem.Organization
    strOSProductSuite = objItem.OSProductSuite
    strRegisteredUser = objItem.RegisteredUser
    strServicePackMajorVersion = objItem.ServicePackMajorVersion
    strServicePackMinorVersion = objItem.ServicePackMinorVersion
    strVersion = objItem.Version
    strWindowsDirectory = objItem.WindowsDirectory

Next

Set colSMBIOS = objWMIService.ExecQuery ("Select * from Win32_SystemEnclosure")
For Each objSMBIOS in colSMBIOS
    strSerialNumber = objSMBIOS.SerialNumber 
Next

Set colCOMpn = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)
For Each objCOMpn in colCOMpn
    strManufacturer = objCOMpn.Manufacturer
    strModel = objCOMpn.Model
    strUserName = objCOMpn.UserName
next   

'*************Do the update or insert in table inventTB****************************

objRS.Find "ComputerName='" & strComputer & "'"
If objRS.EOF Then
  strsql = "Insert into inventTB " & _
    "(Caption,Description,InstallDate,Organization,OSProductSuite,RegisteredUser," & _
    "ServicePackMajorVersion,ServicePackMinorVersion,Version,WindowsDirectory," & _
    "SerialNumber,Manufacturer,Model,UserName,ComputerName) VALUES " & _
    "('" & strCaption & "'," & _
    "'" & strDescription & "'," & _
    "'" & strInstallDate & "'," & _
    "'" & strOrganization & "'," & _
    "'" & strOSProductSuite & "'," & _
    "'" & strRegisteredUser & "'," & _
    "'" & strServicePackMajorVersion & "'," & _
    "'" & strServicePackMinorVersion & "'," & _
    "'" & strVersion & "'," & _
    "'" & strWindowsDirectory & "'," & _
    "'" & strSerialNumber & "'," & _
    "'" & strManufacturer & "'," & _
    "'" & strModel & "'," & _
    "'" & strUserName & "'," & _
    "'" & strComputer & "')"

Else
  strsql = "update inventTB set " & _
    "Caption=' " & strCaption & "'," & _
    "Description=' " & strDescription & "'," & _
    "InstallDate=' " & strInstallDate & "'," & _
    "Organization=' " & strOrganization & "'," & _
    "OSProductSuite=' " & strOSProductSuite & "'," & _
    "RegisteredUser=' " & strRegisteredUser & "'," & _
    "ServicePackMajorVersion=' " & strServicePackMajorVersion & "'," & _
    "ServicePackMinorVersion=' " & strServicePackMinorVersion & "'," & _
    "Version=' " & strVersion & "'," & _
    "WindowsDirectory=' " & strWindowsDirectory & "'," & _
    "SerialNumber=' " & strSerialNumber & "'," & _
    "Manufacturer=' " & strManufacturer & "'," & _
    "Model=' " & strModel & "'," & _
    "UserName=' " & strUserName & "' " & _
    "WHERE ComputerName=' " & strComputer & "'" 
End If
objconn.Execute strsql

objRS.Close

' ******************Get the compID nr for the specific computer**************************


Set objRS = CreateObject("ADODB.Recordset")
objRS.Open "SELECT compID FROM inventTB WHERE ComputerName='" & strComputer & "'", objConn, 3, 3
 
   compIDnr = objRS("compID") 
objRS.close


' ******************Get the data to update or insert into inventNIC table***************************

Set objRS = CreateObject("ADODB.Recordset")
objRS.Open "SELECT * FROM inventNIC" , objConn, 3, 3

Set colAdapters = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")

     n = 1

   For Each objAdapter in colAdapters
    strNicDescription = objAdapter.Description
    strMACAddress = objAdapter.MACAddress
    strDNSHostName = objAdapter.DNSHostName
    
   If Not IsNull(objAdapter.IPAddress) Then
      For i = 0 To UBound(objAdapter.IPAddress)
    strIPAddress = objAdapter.IPAddress(i)
      Next
   End If

   If Not IsNull(objAdapter.IPSubnet) Then
      For i = 0 To UBound(objAdapter.IPSubnet)
    strIPSubnet = objAdapter.IPSubnet(i)
      Next
   End If
 
   If Not IsNull(objAdapter.DefaultIPGateway) Then
      For i = 0 To UBound(objAdapter.DefaultIPGateway)
    strDefaultIPGateway = objAdapter.DefaultIPGateway(i) 
     Next
   End If
 
   If Not IsNull(objAdapter.DNSServerSearchOrder) Then
      For i = 0 To UBound(objAdapter.DNSServerSearchOrder)
    strDNSServerSearchOrder = objAdapter.DNSServerSearchOrder(i) 
      Next
   End If
    
    strDNSDomain = objAdapter.DNSDomain(i) 

   If Not IsNull(objAdapter.DNSDomainSuffixSearchOrder) Then
      For i = 0 To UBound(objAdapter.DNSDomainSuffixSearchOrder)
    strDNSDomainSuffixSearchOrder = objAdapter.DNSDomainSuffixSearchOrder(i) 
      Next
   End If
 
    strDHCPEnabled = objAdapter.DHCPEnabled 
    strDHCPServer = objAdapter.DHCPServer 

                         
    If Not IsNull(objAdapter.DHCPLeaseObtained) Then
        utcLeaseObtained = objAdapter.DHCPLeaseObtained & vbCrLf
        strLeaseObtained = WMIDateStringToDate(utcLeaseObtained)
   
            End If


    If Not IsNull(objAdapter.DHCPLeaseExpires) Then
        utcLeaseExpires = objAdapter.DHCPLeaseExpires & vbCrLf
        strLeaseExpires = WMIDateStringToDate(utcLeaseExpires)
   
        End If
            
    strWINSPrimaryServer = objAdapter.WINSPrimaryServer 
    strWINSSecondaryServer = objAdapter.WINSSecondaryServer 
 
         n = n + 1   

Next

'*************Do the update or insert in table inventNIC****************************

objRS.Find "compID='" & compIDnr & "'"
If objRS.EOF Then
  strsql = "Insert into inventNIC " & _
    "(compID,Description,MACAddress,DNSHostName,IPAddress,IPSubnet," & _
    "DefaultIPGateway,DNSServerSearchOrder,DNSDomain,DNSDomainSuffixSearchOrder," & _
    "DHCPEnabled,DHCPServer,strLeaseObtained,strLeaseExpires,WINSPrimaryServer,WINSSecondaryServer) VALUES " & _
    "('" & compIDnr & "'," & _
    "'" & strDescription & "'," & _
    "'" & strMACAddress & "'," & _
    "'" & strDNSHostName & "'," & _
    "'" & strIPAddress & "'," & _
    "'" & strIPSubnet & "'," & _
    "'" & strDefaultIPGateway & "'," & _
    "'" & strDNSServerSearchOrder & "'," & _
    "'" & strDNSDomain & "'," & _
    "'" & strDNSDomainSuffixSearchOrder & "'," & _
    "'" & strDHCPEnabled & "'," & _
    "'" & strDHCPServer & "'," & _
    "'" & strLeaseObtained & "'," & _
    "'" & strLeaseExpires & "'," & _
    "'" & strWINSPrimaryServer & "'," & _
    "'" & strWINSSecondaryServer & "')"

Else
  strsql = "update inventNIC set " & _
    "Description=' " & strNicDescription & "'," & _
    "MACAddress=' " & strMACAddress & "'," & _
    "DNSHostName=' " & strDNSHostName & "'," & _
    "IPAddress=' " & strIPAddress & "'," & _
    "IPSubnet=' " & strIPSubnet & "'," & _
    "DefaultIPGateway=' " & strDefaultIPGateway & "'," & _
    "DNSServerSearchOrder=' " & strDNSServerSearchOrder & "'," & _
    "DNSDomain=' " & strDNSDomain & "'," & _
    "DNSDomainSuffixSearchOrder=' " & strDNSDomainSuffixSearchOrder & "'," & _
    "DHCPEnabled=' " & strDHCPEnabled & "'," & _
    "DHCPServer=' " & strDHCPServer & "'," & _
    "strLeaseObtained=' " & strLeaseObtained & "'," & _
    "strLeaseExpires=' " & strLeaseExpires & "'," & _
    "WINSPrimaryServer=' " & strWINSPrimaryServer & "'," & _
    "WINSSecondaryServer=' " & strWINSSecondaryServer & "' " & _
    "WHERE compID=' " & compIDnr & "'" 
End If
objconn.Execute strsql

objRS.Close



Set objRS = Nothing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top