Query as input for my array?
-
I currently have a timer that uses an array to see if there are specific exe's running on my machine. Dim strProcArray() As String={"notepad","calcualtor"} Dim i As Integer For i=0 To UBound(strProcArray) buildProcess(strProcArray(i)) next i End Sub So here is my question? Is it possible to use a data reader (SQL SRVR2K) to to query a table with exe file names in it and loop through that as my array? Is a data reader the right choice? If possible a sample would be great. Regards
-
I currently have a timer that uses an array to see if there are specific exe's running on my machine. Dim strProcArray() As String={"notepad","calcualtor"} Dim i As Integer For i=0 To UBound(strProcArray) buildProcess(strProcArray(i)) next i End Sub So here is my question? Is it possible to use a data reader (SQL SRVR2K) to to query a table with exe file names in it and loop through that as my array? Is a data reader the right choice? If possible a sample would be great. Regards
Dim conn As New SqlConnection(''''YourConnectionStringHere) Dim cmd As New SqlCommand Dim dr As SqlClient.SqlDataReader With cmd .Connection = conn .CommandType = CommandType.Text .CommandText = "SELECT ExeName FROM tProcessNames" .Connection.Open() dr = .ExecuteReader(CommandBehavior.CloseConnection) While dr.Read buildProcess(dr.Item("ExeName").ToString) End While End With dr.Close() If I understand you right that should do it. Hope it helps