|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
SQL Syntax errorI 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 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 > Marina Levit [MVP] wrote:
> Are you sure this is the case? I've never heard of this, nor have I Of course I'm sure. It's why I'm asking here.> ever experienced anything like that. Invalid SQL issues have always > caused an exception on the ExecuteReader line. I think the problem is with having invalid search text for CONTAINS. This will produce an error - CONTAINS(TEXT_COLUMN,'alpha beta') MH |
|||||||||||||||||||||||