Passing Parameters to a query

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

    Passing Parameters to a query

    I am running into an issue when I try to write more than 1024 characters to
    a memo field. Apparantly the odbc connection I am using does not permit
    literals to be larger that 1024 characters. This Memo filed can take
    virtually infinate data, so the solution seems to be use parameters. My
    problem is I have never heard of this and need this to work ASAP. Does
    anyone have a simple example of how Parameters work using ASP?




  • Bob Barrows

    #2
    Re: Passing Parameters to a query

    Johnd wrote:[color=blue]
    > I am running into an issue when I try to write more than 1024
    > characters to a memo field. Apparantly the odbc connection I am[/color]

    That's your first problem. You should be using the native Jet OLEDB
    provider. See www.able-consulting.com/ado_conn.htm for examples.
    [color=blue]
    > using does not permit literals to be larger that 1024 characters.
    > This Memo filed can take virtually infinate data, so the solution
    > seems to be use parameters. My problem is I have never heard of this
    > and need this to work ASAP. Does anyone have a simple example of how
    > Parameters work using ASP?[/color]



    HTH,
    Bob Barrows

    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Comment

    • Johnd

      #3
      Re: Passing Parameters to a query

      Thanks Bob but heres a little more detail.

      I am using Advantage server 6.2

      here is my code:


      // Set Conn = Server.CreateOb ject("ADODB.Con nection")
      // Conn.Open "DSN=LocalO P"
      // strQuery = "insert into NCRheadcomments (hdrcomid, headerid, comdate,
      userid, comments, comtime)" &_
      // "values(10084,1 0080, '" & FormatDateTime( Date(), VBshortDate ) &_
      // "', '" & session("Curren tUser") & "', '" & CurrentComment & "', '" &
      time & "')"
      // Set objRS = Conn.Execute(st rQuery)
      // conn.close


      My problem is CurrentComment is larger than 1024 characters. Is there a way
      to get this to work without using a saved query as I do not believe that is
      available to my at this time.

      John,



      "Bob Barrows" <reb01501@NOyah oo.SPAMcom> wrote in message
      news:uXD3aT$wDH A.2156@TK2MSFTN GP09.phx.gbl...[color=blue]
      > Johnd wrote:[color=green]
      > > I am running into an issue when I try to write more than 1024
      > > characters to a memo field. Apparantly the odbc connection I am[/color]
      >
      > That's your first problem. You should be using the native Jet OLEDB
      > provider. See www.able-consulting.com/ado_conn.htm for examples.
      >[color=green]
      > > using does not permit literals to be larger that 1024 characters.
      > > This Memo filed can take virtually infinate data, so the solution
      > > seems to be use parameters. My problem is I have never heard of this
      > > and need this to work ASAP. Does anyone have a simple example of how
      > > Parameters work using ASP?[/color]
      >
      >[/color]
      http://www.google.com/groups?hl=en&l...phx.gbl&rnum=6[color=blue]
      >
      > HTH,
      > Bob Barrows
      >
      > --
      > Microsoft MVP -- ASP/ASP.NET
      > Please reply to the newsgroup. The email account listed in my From
      > header is my spam trap, so I don't check it very often. You will get a
      > quicker response by posting to the newsgroup.
      >
      >[/color]


      Comment

      • Bob Barrows

        #4
        Re: Passing Parameters to a query

        Johnd wrote:[color=blue]
        > Thanks Bob but heres a little more detail.
        >
        > I am using Advantage server 6.2
        >
        > here is my code:
        >
        >
        > // Set Conn = Server.CreateOb ject("ADODB.Con nection")
        > // Conn.Open "DSN=LocalO P"
        > // strQuery = "insert into NCRheadcomments (hdrcomid, headerid,
        > comdate,
        > userid, comments, comtime)" &_
        > // "values(10084,1 0080, '" & FormatDateTime( Date(), VBshortDate
        > ) &_ // "', '" & session("Curren tUser") & "', '" &
        > CurrentComment & "', '" &
        > time & "')"
        > // Set objRS = Conn.Execute(st rQuery)[/color]

        Why are you creating a recordset object to run a non-records-returning
        query? Just do this:
        Conn.Execute strQuery,,129

        [color=blue]
        > // conn.close
        >
        >
        > My problem is CurrentComment is larger than 1024 characters. Is
        > there a way
        > to get this to work without using a saved query as I do not believe
        > that is
        > available to my at this time.[/color]

        Why not? According to their website, Advantage supports stored procedures.

        You will likely need to use AppendChunk
        (http://msdn.microsoft.com/library/en...damth01_3.asp), a
        Command object and a Parameter object. Check out the example in that link.

        I'm sorry but, due to my non-familiarity with Advantage, I am not going to
        be able to get into specifics. Have you tried their support system?

        Bob Barrows
        --
        Microsoft MVP -- ASP/ASP.NET
        Please reply to the newsgroup. The email account listed in my From
        header is my spam trap, so I don't check it very often. You will get a
        quicker response by posting to the newsgroup.


        Comment

        • Johnd

          #5
          Re: Passing Parameters to a query

          Thankyou for taking the time to reply on this issue. I realize this is not
          the best group for this post, but I can't find any leads elsewhere. Also I
          was hoping that this waas a limitation of SQL and therefore best handled
          here. I have looked for stored procedures and been told that they are not
          supported in the Novell version of advanage 6.2 I will look further into
          it. In the mean time I will look at the "chunk" solution you have suggested
          and post my results for future reference.

          John,

          BTW. It never occured to me to just execute the object Conn.Execute
          strQuery,,129



          "Bob Barrows" <reb01501@NOyah oo.SPAMcom> wrote in message
          news:ONtKGPAxDH A.2456@TK2MSFTN GP10.phx.gbl...[color=blue]
          > Johnd wrote:[color=green]
          > > Thanks Bob but heres a little more detail.
          > >
          > > I am using Advantage server 6.2
          > >
          > > here is my code:
          > >
          > >
          > > // Set Conn = Server.CreateOb ject("ADODB.Con nection")
          > > // Conn.Open "DSN=LocalO P"
          > > // strQuery = "insert into NCRheadcomments (hdrcomid, headerid,
          > > comdate,
          > > userid, comments, comtime)" &_
          > > // "values(10084,1 0080, '" & FormatDateTime( Date(), VBshortDate
          > > ) &_ // "', '" & session("Curren tUser") & "', '" &
          > > CurrentComment & "', '" &
          > > time & "')"
          > > // Set objRS = Conn.Execute(st rQuery)[/color]
          >
          > Why are you creating a recordset object to run a non-records-returning
          > query? Just do this:
          > Conn.Execute strQuery,,129
          >
          >[color=green]
          > > // conn.close
          > >
          > >
          > > My problem is CurrentComment is larger than 1024 characters. Is
          > > there a way
          > > to get this to work without using a saved query as I do not believe
          > > that is
          > > available to my at this time.[/color]
          >
          > Why not? According to their website, Advantage supports stored procedures.
          >
          > You will likely need to use AppendChunk
          > (http://msdn.microsoft.com/library/en...damth01_3.asp), a
          > Command object and a Parameter object. Check out the example in that link.
          >
          > I'm sorry but, due to my non-familiarity with Advantage, I am not going to
          > be able to get into specifics. Have you tried their support system?
          >
          > Bob Barrows
          > --
          > Microsoft MVP -- ASP/ASP.NET
          > Please reply to the newsgroup. The email account listed in my From
          > header is my spam trap, so I don't check it very often. You will get a
          > quicker response by posting to the newsgroup.
          >
          >[/color]


          Comment

          • Ray at

            #6
            Re: Passing Parameters to a query


            "Bob Barrows" <reb01501@NOyah oo.SPAMcom> wrote in message
            news:ONtKGPAxDH A.2456@TK2MSFTN GP10.phx.gbl...
            [color=blue]
            >
            > Why are you creating a recordset object to run a non-records-returning
            > query? Just do this:
            > Conn.Execute strQuery,,129
            >[/color]

            What's this Bob? Is that a numeric value of 129 instead of defining a
            constant? :P

            Ray at work


            Comment

            • Bob Barrows

              #7
              Re: Passing Parameters to a query

              Ray at <%=sLocation% > wrote:[color=blue]
              > "Bob Barrows" <reb01501@NOyah oo.SPAMcom> wrote in message
              > news:ONtKGPAxDH A.2456@TK2MSFTN GP10.phx.gbl...
              >[color=green]
              >>
              >> Why are you creating a recordset object to run a
              >> non-records-returning query? Just do this:
              >> Conn.Execute strQuery,,129
              >>[/color]
              >
              > What's this Bob? Is that a numeric value of 129 instead of defining a
              > constant? :P
              >[/color]
              I was going to tell him to go look it up if he asked ;-)
              --
              Microsoft MVP -- ASP/ASP.NET
              Please reply to the newsgroup. The email account listed in my From
              header is my spam trap, so I don't check it very often. You will get a
              quicker response by posting to the newsgroup.


              Comment

              • Dave Anderson

                #8
                Re: Passing Parameters to a query

                "Ray at <%=sLocation% >" wrote:[color=blue]
                >
                > What's this Bob? Is that a numeric value of 129 instead of
                > defining a constant?[/color]

                What would he call it? adCmdTextExecut eNoRecords ?


                --
                Dave Anderson

                Unsolicited commercial email will be read at a cost of $500 per message. Use
                of this email address implies consent to these terms. Please do not contact
                me directly or ask me to contact you directly for assistance. If your
                question is worth asking, it's worth posting.


                Comment

                • Ray at

                  #9
                  Re: Passing Parameters to a query

                  adChar?

                  Ray at work

                  "Dave Anderson" <GTSPXOESSGOQ@s pammotel.com> wrote in message
                  news:uRdrb3AxDH A.3224@tk2msftn gp13.phx.gbl...[color=blue]
                  > "Ray at <%=sLocation% >" wrote:[color=green]
                  > >
                  > > What's this Bob? Is that a numeric value of 129 instead of
                  > > defining a constant?[/color]
                  >
                  > What would he call it? adCmdTextExecut eNoRecords ?
                  >
                  >
                  > --
                  > Dave Anderson
                  >
                  > Unsolicited commercial email will be read at a cost of $500 per message.[/color]
                  Use[color=blue]
                  > of this email address implies consent to these terms. Please do not[/color]
                  contact[color=blue]
                  > me directly or ask me to contact you directly for assistance. If your
                  > question is worth asking, it's worth posting.
                  >
                  >[/color]


                  Comment

                  • Johnd

                    #10
                    Re: Passing Parameters to a query

                    If you guys put as much effort into helping people as you do into you
                    humour, I think there may be hope for some of us rookies :-)


                    "Ray at <%=sLocation% >" <myfirstname at lane34 dot com> wrote in message
                    news:%23m7qRCBx DHA.2464@TK2MSF TNGP12.phx.gbl. ..[color=blue]
                    > adChar?
                    >
                    > Ray at work
                    >
                    > "Dave Anderson" <GTSPXOESSGOQ@s pammotel.com> wrote in message
                    > news:uRdrb3AxDH A.3224@tk2msftn gp13.phx.gbl...[color=green]
                    > > "Ray at <%=sLocation% >" wrote:[color=darkred]
                    > > >
                    > > > What's this Bob? Is that a numeric value of 129 instead of
                    > > > defining a constant?[/color]
                    > >
                    > > What would he call it? adCmdTextExecut eNoRecords ?
                    > >
                    > >
                    > > --
                    > > Dave Anderson
                    > >
                    > > Unsolicited commercial email will be read at a cost of $500 per message.[/color]
                    > Use[color=green]
                    > > of this email address implies consent to these terms. Please do not[/color]
                    > contact[color=green]
                    > > me directly or ask me to contact you directly for assistance. If your
                    > > question is worth asking, it's worth posting.
                    > >
                    > >[/color]
                    >
                    >[/color]


                    Comment

                    • Ray at

                      #11
                      Re: Passing Parameters to a query

                      Does that mean your problem is not solved?

                      Bob yelled at me once for suggesting that people should memorize common
                      constants and use their numeric values, so I had to call him on it. :]

                      Ray at work

                      "Johnd" <johnjob{a}mywa y.com> wrote in message
                      news:%23U8K%23I BxDHA.2444@TK2M SFTNGP09.phx.gb l...[color=blue]
                      > If you guys put as much effort into helping people as you do into you
                      > humour, I think there may be hope for some of us rookies :-)
                      >
                      >
                      > "Ray at <%=sLocation% >" <myfirstname at lane34 dot com> wrote in message
                      > news:%23m7qRCBx DHA.2464@TK2MSF TNGP12.phx.gbl. ..[color=green]
                      > > adChar?
                      > >
                      > > Ray at work
                      > >
                      > > "Dave Anderson" <GTSPXOESSGOQ@s pammotel.com> wrote in message
                      > > news:uRdrb3AxDH A.3224@tk2msftn gp13.phx.gbl...[color=darkred]
                      > > > "Ray at <%=sLocation% >" wrote:
                      > > > >
                      > > > > What's this Bob? Is that a numeric value of 129 instead of
                      > > > > defining a constant?
                      > > >
                      > > > What would he call it? adCmdTextExecut eNoRecords ?
                      > > >
                      > > >
                      > > > --
                      > > > Dave Anderson
                      > > >
                      > > > Unsolicited commercial email will be read at a cost of $500 per[/color][/color][/color]
                      message.[color=blue][color=green]
                      > > Use[color=darkred]
                      > > > of this email address implies consent to these terms. Please do not[/color]
                      > > contact[color=darkred]
                      > > > me directly or ask me to contact you directly for assistance. If your
                      > > > question is worth asking, it's worth posting.
                      > > >
                      > > >[/color]
                      > >
                      > >[/color]
                      >
                      >[/color]


                      Comment

                      • Johnd

                        #12
                        Re: Passing Parameters to a query

                        I have been programming for 14 years and I hate trying to figure out what a
                        constant means in a example. I know they make code more "readable", but I
                        am never sure if it's a constant, function, Reserved word etc. so when I am
                        trying to understand something new, I prefer to see it without constants and
                        then I'll make my own constants if I need them.

                        Anyway I have tried switching to native OLE, (so far unsuccessful) and have
                        yet to find any good reference to using parameters on advantage 6.2 for
                        Novell. I have rewritten my routine to truncate anything over 1024 chars
                        and create a new record with this data. Since this is only tracking info,
                        it doesn't matter, but I will need a solution because I have other memo
                        fields that I can't just truncate.

                        John,



                        "Ray at <%=sLocation% >" <myfirstname at lane34 dot com> wrote in message
                        news:O4ATVTBxDH A.2064@TK2MSFTN GP10.phx.gbl...[color=blue]
                        > Does that mean your problem is not solved?
                        >
                        > Bob yelled at me once for suggesting that people should memorize common
                        > constants and use their numeric values, so I had to call him on it. :]
                        >
                        > Ray at work
                        >
                        > "Johnd" <johnjob{a}mywa y.com> wrote in message
                        > news:%23U8K%23I BxDHA.2444@TK2M SFTNGP09.phx.gb l...[color=green]
                        > > If you guys put as much effort into helping people as you do into you
                        > > humour, I think there may be hope for some of us rookies :-)
                        > >
                        > >
                        > > "Ray at <%=sLocation% >" <myfirstname at lane34 dot com> wrote in message
                        > > news:%23m7qRCBx DHA.2464@TK2MSF TNGP12.phx.gbl. ..[color=darkred]
                        > > > adChar?
                        > > >
                        > > > Ray at work
                        > > >
                        > > > "Dave Anderson" <GTSPXOESSGOQ@s pammotel.com> wrote in message
                        > > > news:uRdrb3AxDH A.3224@tk2msftn gp13.phx.gbl...
                        > > > > "Ray at <%=sLocation% >" wrote:
                        > > > > >
                        > > > > > What's this Bob? Is that a numeric value of 129 instead of
                        > > > > > defining a constant?
                        > > > >
                        > > > > What would he call it? adCmdTextExecut eNoRecords ?
                        > > > >
                        > > > >
                        > > > > --
                        > > > > Dave Anderson
                        > > > >
                        > > > > Unsolicited commercial email will be read at a cost of $500 per[/color][/color]
                        > message.[color=green][color=darkred]
                        > > > Use
                        > > > > of this email address implies consent to these terms. Please do not
                        > > > contact
                        > > > > me directly or ask me to contact you directly for assistance. If[/color][/color][/color]
                        your[color=blue][color=green][color=darkred]
                        > > > > question is worth asking, it's worth posting.
                        > > > >
                        > > > >
                        > > >
                        > > >[/color]
                        > >
                        > >[/color]
                        >
                        >[/color]


                        Comment

                        • Bob Barrows

                          #13
                          Re: Passing Parameters to a query

                          Dave Anderson wrote:[color=blue]
                          > "Ray at <%=sLocation% >" wrote:[color=green]
                          >>
                          >> What's this Bob? Is that a numeric value of 129 instead of
                          >> defining a constant?[/color]
                          >
                          > What would he call it? adCmdTextExecut eNoRecords ?[/color]
                          :-)

                          I wouldn't create a new constant: I would add together the already-existing
                          constants.

                          adCmdText + adExecuteNoReco rds

                          Bob
                          --
                          Microsoft MVP -- ASP/ASP.NET
                          Please reply to the newsgroup. The email account listed in my From
                          header is my spam trap, so I don't check it very often. You will get a
                          quicker response by posting to the newsgroup.


                          Comment

                          • Bob Barrows

                            #14
                            Re: Passing Parameters to a query

                            Ray at <%=sLocation% > wrote:[color=blue]
                            > Does that mean your problem is not solved?
                            >
                            > Bob yelled at me once for suggesting that people should memorize
                            > common constants and use their numeric values, so I had to call him
                            > on it. :]
                            >[/color]

                            Now wait a minute, I have never yelled at anyone in these newsgroups ....
                            well ... not until this week that is <blush>

                            I expressed and defended my opinion ... yes, that's the ticket :-)

                            Bob

                            --
                            Microsoft MVP -- ASP/ASP.NET
                            Please reply to the newsgroup. The email account listed in my From
                            header is my spam trap, so I don't check it very often. You will get a
                            quicker response by posting to the newsgroup.


                            Comment

                            • Bob Barrows

                              #15
                              Re: Passing Parameters to a query

                              Johnd wrote:[color=blue]
                              > I have been programming for 14 years and I hate trying to figure out
                              > what a constant means in a example. I know they make code more
                              > "readable", but I am never sure if it's a constant, function,
                              > Reserved word etc.[/color]

                              That's where good naming conventions come to the rescue.
                              [color=blue]
                              > so when I am trying to understand something new,
                              > I prefer to see it without constants and then I'll make my own
                              > constants if I need them.
                              >[/color]
                              I'm the opposite. I hate having to look up what the magic numbers mean. I've
                              got better use for my brainpower than memorizing a bunch of numbers:
                              especially when the documentation shows their hex values <grr>

                              HTH,
                              Bob Barrows

                              --
                              Microsoft MVP -- ASP/ASP.NET
                              Please reply to the newsgroup. The email account listed in my From
                              header is my spam trap, so I don't check it very often. You will get a
                              quicker response by posting to the newsgroup.


                              Comment

                              Working...