Home All Groups Group Topic Archive Search About
Author
6 Mar 2006 9:25 AM
Marius Horak
I have something like that

SqlCommand cmd = new SqlCommand(sqlText, connection);
SqlDataReader data = cmd.Execute();
while (data.Read())
{
...do my stuff
}

When sqlText is invalid the error does not occur on cmd.Execute (as I
would expect) but on data.Read().

Is it the correct DotNet behaviour or some stupid setup on my PC?

Thanks

MH

Author
6 Mar 2006 4:39 PM
Marina Levit [MVP]
Are you sure this is the case? I've never heard of this, nor have I ever
experienced anything like that.  Invalid SQL issues have always caused an
exception on the ExecuteReader line.

Show quote
"Marius Horak" <nob***@eu.con> wrote in message
news:eUcAk$PQGHA.4976@TK2MSFTNGP11.phx.gbl...
>I have something like that
>
> SqlCommand cmd = new SqlCommand(sqlText, connection);
> SqlDataReader data = cmd.Execute();
> while (data.Read())
> {
> ..do my stuff
> }
>
> When sqlText is invalid the error does not occur on cmd.Execute (as I
> would expect) but on data.Read().
>
> Is it the correct DotNet behaviour or some stupid setup on my PC?
>
> Thanks
>
> MH
>
Author
7 Mar 2006 8:35 AM
Marius Horak
Marina Levit [MVP] wrote:

> Are you sure this is the case? I've never heard of this, nor have I
> ever experienced anything like that.  Invalid SQL issues have always
> caused an exception on the ExecuteReader line.

Of course I'm sure. It's why I'm asking here.
I think the problem is with having invalid search text for CONTAINS.
This will produce an error - CONTAINS(TEXT_COLUMN,'alpha beta')

MH

AddThis Social Bookmark Button