I am just trying to get the information i collect from the pc's hostname and pass it into a db. All the db passwords, location etc are correct but i am getting nothing.
Imports System Imports Microsoft.Win32 Imports System.Data Imports System.Data.SqlClient Public Class Form1 Private Sub DB() 'Your log file reader code goes here 'The code below will insert one text value into one record. Make sure there are no unique ID's etc that need to be added as well 'If there are then these will have to be added also Dim myhostnameDescription As String = My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\", "Hostname", "No Data Found").ToString.Trim Dim sqlConn As SqlConnection Dim sqlCmd As SqlCommand Dim myConnString As String Dim rowsAffected As Integer Try myConnString = "user id=user;data source=laptop34;persist security info=True;initial catalog=ClientAuditData;password=passw0rD" ' Create a new connection object sqlConn = New SqlConnection(myConnString) ' Create a new command object sqlCmd = New SqlCommand ' Specify the SQL expression and connection With sqlCmd .CommandType = CommandType.Text .Connection = sqlConn End With ' Open the connection sqlConn.Open() ' Execute the command. This returns rows affected. 'insert record sqlCmd.CommandText = "insert into SystemData (SystemName) Values(" & myhostnameDescription & ");" rowsAffected = sqlCmd.ExecuteNonQuery() Catch exc As SqlException ' Handle the exception Â… MsgBox(Err.Description) Finally ' Close connection regardless of outcome sqlConn = Nothing sqlConn.Close() End Try End Sub End Class