Skip to main content

Search

Search

Change Label Text Through Loop

Comments

3 comments

  • Avatar
    Legacy Poster

    Ok, I'm probably even "newer" to VBS than you, but maybe we both can learn something :)

     

    1) So... you don't want to retrieve the value of each individual field of the current record, but the values of all fields of the current record? Have you tried something like:

    val = rs.GetString(,1)
    

     

    2) By "Object Value" you mean the value of a BarTender object (e.g. text element)? Have you tried:

    val = Format.Objects("Text 3").Value
    

     

    3) I'm not sure I understand what you mean... You are querying the database based on the QueryPrompt entry (second picture). I assume that the result will be displayed in a BarTender object on the label? If that result is what you need in your VBScript, you should be able to get it by assigning a name to the data source (object properties) and then retrieving the value in VBS using:

    val = Format.NamedSubStrings("Whatevernameyouassigned").Value
    
    0
  • Avatar
    Legacy Poster

    I get this working with you help.

     

    It look like something like that

     

     

    Dim cn
    Dim rs
    
    set cn = CreateObject("ADODB.Connection")
    set rs = CreateObject("ADODB.Recordset")
    cn.connectionString = "Driver={MySQL ODBC 5.3 ANSI driver};Server=127.0.0.1;Database=;UID=;PWD=;"
    cn.open
    rs.open "SELECT something", cn, 3
    rs.MoveFirst
    
    dim val
    while not rs.eof
        val = val & rs.GetString(,1)
    wend
    
    Format.NamedSubStrings("test").Value = val
    
    cn.close
     
    0
  • Avatar
    Legacy Poster

    In your "While Not" section: Aren't you just adding each line of the entire recordset separately here...? Couldn't you just use "val = rs.GetString()" without the While loop and get the same result?

     

    It seems like your method only really makes sense if you have to do something with each record/line...?

    0

Please sign in to leave a comment.