Re: What's wrong with my SqlCommand?

Tech-Archive recommends: Fix windows errors by optimizing your registry



"Jason Huang" <JasonHuang8888@xxxxxxxxxxx> schrieb im Newsbeitrag
news:OkRmKMzHHHA.3872@xxxxxxxxxxxxxxxxxxxxxxx
Hi,

In my codes:
=======================================
myConn.Open();
SqlTransaction MyTrans= myConn.BeginTransaction();

SqlCommand myCommand = new SqlCommand("ZZZ15UserLog",myConn);
myCommand.CommandType= CommandType.StoredProcedure;
SqlDataReader myReader;

myCommand.Transaction=MyTrans;
try
{
myCommand.ExecuteReader();
MyTrans.Commit();
}
catch { }
========================================

That will result in some error,
<snip>
What is the error? The message and the type of the exception will give
information about what went wrong.

If ExecuteReader failed but ExecuteNonQuery not, then maybe the procedure
doesn't return any result.



.