System.InvalidCastException

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Brian Conway

    #1

    System.InvalidCastException

    Hope someone can help. I am trying to get a submit button working and
    getting this error now System.InvalidC astException: Object must implement
    IConvertible. This is showing up on the ExecuteNonQuery line. Below is the
    code that I have in my Page_load. I also have no idea of what code I would
    use in the Submit_Click event to get the insert to work. Any help would be
    appreciated

    OleDbConnection conn = new
    OleDbConnection ("Provider=OraO LEDB.Oracle.1;P ersist Security
    Info=False;"+"U ser ID=conference;P assword=conf00; Data
    Source=ntdrp001 .world;");

    OleDbCommand command = new OleDbCommand("C ONF-REQUEST_INSERT" , conn);

    command.Command Type = CommandType.Sto redProcedure;

    command.Paramet ers.Add("DropDo wnList1", OleDbType.VarCh ar).Value =
    DropDownList1;

    command.Paramet ers.Add("DropDo wnList2", OleDbType.VarCh ar).Value =
    DropDownList2;

    command.Paramet ers.Add("txtESt artDate", OleDbType.Date) .Value =
    txtEStartDate;

    command.Paramet ers.Add("txtEEn dDate", OleDbType.Date) .Value = txtEEndDate;

    command.Paramet ers.Add("txtESt artTime", OleDbType.Numer ic).Value =
    txtEStartTime;

    command.Paramet ers.Add("txtEEn dTime", OleDbType.Numer ic).Value =
    txtEEndTime;

    command.Paramet ers.Add("txtEve ntName", OleDbType.VarCh ar).Value =
    txtEventName;

    command.Paramet ers.Add("txtEve ntSize", OleDbType.Numer ic).Value =
    txtEventSize;

    command.Paramet ers.Add("txtSSt artDate", OleDbType.Date) .Value =
    txtSStartDate;

    command.Paramet ers.Add("txtSSt artTime", OleDbType.Numer ic).Value =
    txtSStartTime;

    command.Paramet ers.Add("txtEve ntDescription", OleDbType.VarCh ar).Value =
    txtEventDescrip tion;

    command.Paramet ers.Add("txtSpe cialRequirement s", OleDbType.VarCh ar).Value =
    txtSpecialRequi rements;

    conn.Open();

    int rows = command.Execute NonQuery();

    conn.Close();


  • Jon Skeet [C# MVP]

    #2
    Re: System.InvalidC astException

    Brian Conway <Brian.Conway@q west.com> wrote:[color=blue]
    > Hope someone can help.[/color]

    <snip>

    Please see my response on the C# group - and please consider not multi-
    posting in future, as it fragments discussions. If you *must* post to
    more than one group (and in this case, the ADO.NET group would probably
    have been the best one to post to) please consider cross-posting
    instead.

    --
    Jon Skeet - <skeet@pobox.co m>
    Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

    If replying to the group, please do not mail me too

    Comment

    Working...