new OdbcParameter("

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Christopher Weaver

    new OdbcParameter("

    I'm more than a little bit confused by the last parameter of one of the
    overloads of this constructor. I'm pretty certain that I need to specify
    that the parameter is an output and what the source column is, and so I'm
    constrained to this overload. I just don't know what the last parameter is
    for.

    I'm creating the update SQL, shown below. I've included a reference to an
    object in the tenth parameter, as required by the constructors parameter
    list, but it seems to be redundant in light of the ninth parameter, which is
    said to be the name of the source column. If anyone could shed some light
    on this for me I would be very grateful.

    Also, is there another way to go about this that would not involve using
    this particular overload of the OdbcParameter constructor?

    cmd.CommandText = "@UPDATE \"tblSubCategor y\" SET \"SubCategor y\" = ? "
    + "WHERE \"Category\" = ?; "
    + "UPDATE \"tblCategor y\" SET \"Category\" =
    ? "
    + "WHERE \"Category\" = ?";
    cmd.Parameters. Add(new System.Data.Odb c.OdbcParameter ("SubCategor y",
    System.Data.Odb c.OdbcType.NVar Char, 50, "SubCategory")) ;
    cmd.Parameters. Add(new System.Data.Odb c.OdbcParameter ("Category",
    System.Data.Odb c.OdbcType.NVar Char, 50, "Category") );
    cmd.Parameters. Add(new System.Data.Odb c.OdbcParameter ("NewCategor y",
    System.Data.Odb c.OdbcType.NVar Char, 50, "Category") );
    cmd.Parameters. Add(new System.Data.Odb c.OdbcParameter ("OldCategor y",
    System.Data.Odb c.OdbcType.NVar Char, 50, ParameterDirect ion.Output, false, 0,
    0, "Category", DataRowVersion. Current,
    dsCatSubCats.Ta bles["Categories "].Columns["Category"] ));


  • arunprakashb@gmail.com

    #2
    Re: new OdbcParameter(& quot;

    As far as i see, the tenth parameter is the value of the Odbc Parameter
    whereas the ninth parameter is the name of the parameter. Since the
    category parameter is an output parameter in your case, you pass it as
    null.

    There is another way of doing this without using this constructor.

    OdbcParameter category = new OdbcParameter() ;
    category.Direct ion = ParameterDirect ion.Output;
    .... this way you can set all properties that you want.

    Not sure if this is what you want.

    Regards,
    Arun Prakash. B

    Comment

    • Christopher Weaver

      #3
      Re: new OdbcParameter(& quot;

      This may be exactly what I needed to know. I'm especially intrigued by the
      option of setting the properties after the object is created. Can't believe
      I didn't think of that!


      <arunprakashb@g mail.com> wrote in message
      news:1116972395 .332890.74480@g 43g2000cwa.goog legroups.com...[color=blue]
      > As far as i see, the tenth parameter is the value of the Odbc Parameter
      > whereas the ninth parameter is the name of the parameter. Since the
      > category parameter is an output parameter in your case, you pass it as
      > null.
      >
      > There is another way of doing this without using this constructor.
      >
      > OdbcParameter category = new OdbcParameter() ;
      > category.Direct ion = ParameterDirect ion.Output;
      > ... this way you can set all properties that you want.
      >
      > Not sure if this is what you want.
      >
      > Regards,
      > Arun Prakash. B
      >[/color]


      Comment

      Working...