Re: Unable to set up emailReader



"tshad" <tfs@xxxxxxxxxxxxxx> wrote in message
news:%23DwXTlIXFHA.3340@xxxxxxxxxxxxxxxxxxxxxxx
> I have a dataReader that was used a second time in the same routine and
got
> the following error:
>
> Object must implement IConvertible.
>
> It worked fine just before.

I found the problem. I had been passing ApplicantProfileID as a parameter
value. The problem is that ApplicantProfileID is a TextBox and you can't
use a TextBox as a value.

The statement should have been:

.Add("@ApplicantProfileID",SqlDbType.Bigint).value =
ApplicantProfileID.Text

Tom
>
> I did a stored procedure call just before, closed the connection, set up
the
> new parameters for another stored procedure and got the error when it did:
>
> emailReader = objCmd.ExecuteReader
>
> The code (after the 1st stored procedure is):
>
> *****************************************************************
> objConn.Close
> objCmd.CommandText = "AddNewApplicantProfileAbsentee"
>
> objCmd.Parameters.Clear()
> with objCmd.Parameters
> .Add("@ClientID",SqlDbType.VarChar,20).value = session("ClientID")
> .Add("@ApplicantProfileID",SqlDbType.Bigint).value =
ApplicantProfileID
> end with
> objConn.Open()
> itemp = 1
> emailReader = objCmd.ExecuteReader
> while emailReader.Read
> if not (emailReader("From") is DBNull.Value) then
> txt = DirectCast(Page.FindControl("AbsentFrom" & itemp),TextBox)
> txt.Text = emailReader("From")
> end if
> if not (emailReader("To") is DBNull.Value) then
> txt = DirectCast(Page.FindControl("AbsentTo" & itemp),TextBox)
> txt.Text = emailReader("From")
> end if
> if not (emailReader("Reason") is DBNull.Value) then
> txt = DirectCast(Page.FindControl("AbsentReason" & itemp),TextBox)
> txt.Text = emailReader("From")
> end if
> **********************************************************
>
> I've done this before without any problems - what is this IConvertible
> business?
>
> Thanks,
>
> Tom
>
>


.



Relevant Pages

  • Re: Weird problem.
    ... I'm not familiar with "IDENT_CURRENT" - @@IDENTITY will do this for SQL Server. ... "Tom P." wrote in message ... The stored procedure does an insert then it uses IDENT_CURRENT to get ... back out to display. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: System Cache and expiration
    ... > Maybe as input your stored procedure can accept a list of columns the user ... Is that Dynamic Sql? ... Tom ... >> deletion or reload of an object in the system Cache. ...
    (microsoft.public.dotnet.framework.adonet)
  • Sql Newbie question : Followup
    ... I agree with tom, it is the best way, however if you ... statememt in SQL. ... >think I need the stored procedure to determine if a parm ...
    (microsoft.public.sqlserver.programming)
  • Unable to set up emailReader
    ... I have a dataReader that was used a second time in the same routine and got ... I did a stored procedure call just before, closed the connection, set up the ... emailReader = objCmd.ExecuteReader ...
    (microsoft.public.dotnet.framework.aspnet)
  • decrypt a stored procedure
    ... I'd like to know if i can to decrypt a stored procedure!! ... I have lost source code!! ...
    (microsoft.public.sqlserver.security)