Hi all,
Could someone please explain why the following doesn't work/works:
Ok, I have 3 select statements in my aspx.vb file:
sql1 - which is a long query
sql2 - short query
sql3 - longer than sql1 and have the same pattern as sql1
Then, I use ExecuteReader() method of DataReader to execute the 3 statements together in the following order:
sql1
sql2
sql3
Upon running the project, I got an error stating that a column in the sql1 cannot be found, which is not true (there is nothing wrong with sql1)
But, if the order of the sql statements is changed to
sql2
sql1
sql3
upon the DataReader execution (using ExecuteReader()), then it works!
Also, if I use ExecuteReader to execute each sql statement individually (only one at a time, the other two are commented out), then sql2 and sql3 work, but not sql3 (same error as above). That surprises me since sql1 and sql3 are of the same format and pattern; the sql3 query is even longer than the sql1 query.
I don't know why it happens this way. Please share your thoughts. Thanks.
Could someone please explain why the following doesn't work/works:
Ok, I have 3 select statements in my aspx.vb file:
sql1 - which is a long query
sql2 - short query
sql3 - longer than sql1 and have the same pattern as sql1
Then, I use ExecuteReader() method of DataReader to execute the 3 statements together in the following order:
sql1
sql2
sql3
Upon running the project, I got an error stating that a column in the sql1 cannot be found, which is not true (there is nothing wrong with sql1)
But, if the order of the sql statements is changed to
sql2
sql1
sql3
upon the DataReader execution (using ExecuteReader()), then it works!
Also, if I use ExecuteReader to execute each sql statement individually (only one at a time, the other two are commented out), then sql2 and sql3 work, but not sql3 (same error as above). That surprises me since sql1 and sql3 are of the same format and pattern; the sql3 query is even longer than the sql1 query.
I don't know why it happens this way. Please share your thoughts. Thanks.