My code is working. I feel so foolish. I am using the new System.Transactions
namespace and I was missing a commit in my code so the code was rolling
back...ughhh
I guess these things happen
"Kerry Moorman" wrote:
> WXMCDBA,
>
> Should the @currentdatetime parameter be SqlDbType.DateTime instead of
> SqlDbType.VarChar?
>
> Kerry Moorman
>
>
> "WXMCDBA" wrote:
>
> > Hi everyone. I have a small problem that I can not seem to resolve. I am
> > executing a stored procedure using the ExecuteReader method. However it is
> > failing. Here is my code in short. I debugged it using Sql profiler it
> > appears that my currentdatetime parameter is going to the next line and I am
> > not sure why, but I am positive that this is the reason it is failing. The
> > output is below the code.
> >
> > SqlParameter physID = cmd.Parameters.Add("@phys_id", SqlDbType.Int);
> > SqlParameter lName = cmd.Parameters.Add("@lname",
> > SqlDbType.VarChar, 25);
> > SqlParameter fName = cmd.Parameters.Add("@fname",
> > SqlDbType.VarChar, 15);
> > SqlParameter mName = cmd.Parameters.Add("@mname",
> > SqlDbType.VarChar, 15);
> > SqlParameter suffixCode =
> > cmd.Parameters.Add("@suffix_code", SqlDbType.Char, 4);
> > SqlParameter legalNameInd =
> > cmd.Parameters.Add("@legal_name_ind", SqlDbType.Char, 1);
> > SqlParameter insertLogin =
> > cmd.Parameters.Add("@insert_login", SqlDbType.VarChar, 30);
> > SqlParameter currentDateTime =
> > cmd.Parameters.Add("@currentdatetime", SqlDbType.VarChar, 30);
> > SqlParameter rc = cmd.Parameters.Add("@rc",
> > SqlDbType.Int);
> >
> > //Set the parameter values.
> > physID.Value = physician.PhysId;
> > lName.Value = physician.LastName;
> > fName.Value = physician.FirstName;
> > mName.Value = physician.MidName;
> > suffixCode.Value = physician.SuffixCode;
> > legalNameInd.Value = physician.LegalNameInd;
> > insertLogin.Value = currentUser.Username;
> > currentDateTime.Value = date;
> > rc.Value = 0;
> >
> > rdr = cmd.ExecuteReader();
> > rdr.Close();
> >
> > exec phys_names_isp1
> > @phys_id=34219,@lname='Test4',@fname='Test4',@mname='',@suffix_code=default,@legal_name_ind='Y',@insert_login='kareno_rmf',@currentdatetime='12/27/2005
> > 3:53:43 PM',@rc=0