Re: Unable to set up emailReader
- From: "tshad" <tfs@xxxxxxxxxxxxxx>
- Date: Thu, 19 May 2005 08:26:55 -0700
"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
>
>
.
- References:
- Unable to set up emailReader
- From: tshad
- Unable to set up emailReader
- Prev by Date: Re: HTTP Binary Get
- Next by Date: Re: Question about strong-name dlls
- Previous by thread: Unable to set up emailReader
- Next by thread: Re: HTTP Binary Get
- Index(es):
Relevant Pages
|