Thanks for all the help so far. I was able to send the $Email variable to the stdio stream and receive it in the vb script. I am having a problem now with some of the code
Option Strict On
Imports MySql.Data.MySqlClient
Imports System.Runtime.Serialization
Module jrConnect
Sub Main(ByVal cmdArgs() As String)
Dim returnValue As Integer = 0
' See if there are any arguments.
If cmdArgs.Length > 0 Then
For argNum As Integer = 0 To UBound(cmdArgs, 1)
Console.Write("your email address is " & cmdArgs(argNum))
If cmdArgs(argNum) <> "" Then
Dim email As String = cmdArgs(argNum)
Console.Write("Your email is " & email)
End If
Next argNum
End If
Dim cs As String = "*********"
Dim conn As New MySqlConnection(cs)
Dim entID As String
Try
conn.Open()
Dim stm As String = "SELECT ***** FROM **** WHERE email =" & "'" & email & "'"
Dim cmd As MySqlCommand = New MySqlCommand(stm, conn)
Dim reader As MySqlDataReader = cmd.ExecuteReader()
While reader.Read()
entID = reader.GetString(0)
End While
reader.Close()
Dim stm2 = "SELECT ***** FROM ****** WHERE ***** = " & entID
Dim cmd2 As MySqlCommand = New MySqlCommand(stm2, conn)
Dim reader2 As MySqlDataReader = cmd2.ExecuteReader()
Dim counter As Integer = 0
While reader2.Read() And counter < 3
Console.WriteLine(reader2.GetString(0) & "%")
counter = counter + 1
End While
reader.Close()
Catch ex As MySqlException
Finally
conn.Close()
End Try
End Sub
End Module
It will print the email address correctly but when it calls the email address in the sql statement it states that “email is not declared” Is it changing the value of it in the “Next argNum” command? It only writes the email to console once. Here is my NSIS script if necessary as well.
Outfile "test.exe"
Section
SetOutPath $DOCUMENTS/
Var /GLOBAL Email
StrCpy $Email "spkelly8@gmail.com"
nsExec::ExecToLog '"C:path/vbapp.exe" $Email'
Pop $1
Pop $2
DetailPrint $1
DetailPrint $2
SectionEnd
From the NSIS manual:
Your
console.Readlinewill expect some kind of interation and since its not connected to stdin/stdout, will fail. Since you dont want the DOS box, and you want to send the email string via stdin rather than enter it manually, useExecDos::execNote the
$in front of\nfor NSIS to send a literal new line rather than the string\n