I use the file SQLHelper.cs the way exactly as the PetShop 4.
SQLHelper.cs:
namespace PetShop.DBUtility {
public abstract class SqlHelper {
......
public static SqlDataReader ExecuteReader(string connectionString,
CommandType cmdType, string cmdText, params SqlParameter[] commandParameters)
{
SqlCommand cmd = new SqlCommand();
SqlConnection conn = new SqlConnection(connectionString);
try {
PrepareCommand(cmd, conn, null, cmdType, cmdText,
commandParameters);
SqlDataReader rdr =
cmd.ExecuteReader(CommandBehavior.CloseConnection);
cmd.Parameters.Clear();
return rdr;
}
catch {
conn.Close();
throw;
}
}
.....
}
> Matt,
>
[quoted text clipped - 28 lines]
> > a valid string constant SQL statement. I tried to pass valid parameters too
> > and got the same exception?
Sergey Poberezovskiy - 04 Jul 2007 02:40 GMT
Matt,
I do not beleive that you can step into this method while debugging, do you?
As I mentioned in my previous post, I has this type of exception when the
class static constructor throws an error - so seeing the method code does not
help much :-(
If you can post the class constructor (in case one is present) and all
static initializers, such as following:
private static object _myCustom = new Custom();
Alternatively, if you can post here the link to download the petshot
application, I will try to investigate it further - otherwise there is not
enough info for me to make any conclusions...
I would prefer the first option though - less time for me :-)
> I use the file SQLHelper.cs the way exactly as the PetShop 4.
>
[quoted text clipped - 57 lines]
> > > a valid string constant SQL statement. I tried to pass valid parameters too
> > > and got the same exception?