You can do that. OR since you already know the exact command already, you can use C++ to execute that command exactly and do whatever you need to do to get the output where you want it to go (STDOUT or wherever) using the system command, popen, execvp, pipes, whatever. popen is easy so use that unless there is a reason not to. See code below adapted to your line where "codeblocks" is the process.
Dim Adapter As New OleDbDataAdapter
Dim Command As New OleDbCommand
Dim xFrom As String = dtpFrom.Value.ToString.Substring(0, dtpFrom.Value.ToString.IndexOf(" "))
Dim xTo As String = dtpTo.Value.ToString.Substring(0, dtpTo.Value.ToString.IndexOf(" "))
sqlQuery = MainQuery ...