Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Query as input for my array?

Query as input for my array?

Scheduled Pinned Locked Moved Visual Basic
databasequestiondata-structures
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    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

    D 1 Reply Last reply
    0
    • A Anonymous

      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

      D Offline
      D Offline
      DannyB79
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups