ADO/Function Confusion

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default ADO/Function Confusion

    Hi, I'm baffled and frustrated.

    I'm working on an export process from my web server to our mainframe.
    I can't get the function below to work within the export process.
    When I strip it out and runit by itself(see below), it works. In the
    file where I need it to work, it doesn't. I'm sure the values are
    being passed. The function seems to choke on the rstMain.Open line.
    It won't do a response.write after that.

    I assume something in the rest of my code is interfering. Can you
    suggest things that might cause this problem? Thanks

    John


    <%
    Dim intRecordCount
    Dim strAS400File
    Dim strOrder_ID

    strOrder_ID = "00078275"
    strAS400File = "TEST"
    intRecordCount = Check_Header_RecordCount("",strOrder_ID)
    Response.write("Header intRecordCount: " & intRecordCount & "<br>")
    %>

    <%
    Function Check_Header_RecordCount(strShipTo, strAS400_ID)

    Dim rstMain
    set rstMain = CreateObject("ADODB.Recordset")
    rstMain.CursorLocation = 3
    rstMain.Open "SELECT * FROM " & strAS400File & ".IHWEBHUP WHERE
    CF05AB='" & strShipTo & "' AND ORD#AB='" & strAS400_ID &"'", _
    "DATABASE=IBMDA400.DataSource.1;UID=TESTUSER;PWD=T EST;DSN=TESTDSN"

    Check_Header_RecordCount = rstMain.RecordCount

    rstMain.close

    End Function
    %>
    John Shaw Guest

  2. Similar Questions and Discussions

    1. RRD confusion
      I've been using a script called weathergraph on a FreeBSD box for years. Last week I upgraded the machine, and the script stopped working. One of...
    2. emf confusion
      Can anyone tell me what has happened in the settings of Freehand 8 when this problem occurs: Whereas FH drawings that were made months ago, and...
    3. ai. vs pdf confusion
      My illustrator 10 is not cooperating. After making a file going to file>save>format adobe illus and leaving all options clicked, i hit "ok". the file...
    4. Net Confusion
      It should work, but this problem is notorious to VS.NET. See...
    5. eps confusion
      FH has the ability to edit some EPS file, but not all. In fact eps files FH exports are not editable unless you check "Include Freehand". If you have...
  3. #2

    Default Re: ADO/Function Confusion

    "John Shaw" <jmshaw@weir.net> wrote in message
    news:91422298.0310200727.3b11b003@posting.google.c om...
    > Hi, I'm baffled and frustrated.
    >
    > I'm working on an export process from my web server to our mainframe.
    > I can't get the function below to work within the export process.
    > When I strip it out and runit by itself(see below), it works. In the
    > file where I need it to work, it doesn't. I'm sure the values are
    > being passed. The function seems to choke on the rstMain.Open line.
    > It won't do a response.write after that.
    >
    > I assume something in the rest of my code is interfering. Can you
    > suggest things that might cause this problem? Thanks
    >
    > John
    >
    >
    > <%
    > Dim intRecordCount
    > Dim strAS400File
    > Dim strOrder_ID
    >
    > strOrder_ID = "00078275"
    > strAS400File = "TEST"
    > intRecordCount = Check_Header_RecordCount("",strOrder_ID)
    > Response.write("Header intRecordCount: " & intRecordCount & "<br>")
    > %>
    >
    > <%
    > Function Check_Header_RecordCount(strShipTo, strAS400_ID)
    >
    > Dim rstMain
    > set rstMain = CreateObject("ADODB.Recordset")
    > rstMain.CursorLocation = 3
    > rstMain.Open "SELECT * FROM " & strAS400File & ".IHWEBHUP WHERE
    > CF05AB='" & strShipTo & "' AND ORD#AB='" & strAS400_ID &"'", _
    > "DATABASE=IBMDA400.DataSource.1;UID=TESTUSER;PWD=T EST;DSN=TESTDSN"
    >
    > Check_Header_RecordCount = rstMain.RecordCount
    >
    > rstMain.close
    >
    > End Function
    > %>
    This is just a variation of your code -- does it work?

    <% Option Explicit
    Dim strAS400File
    strAS400File = "TEST"
    Dim strOrder_ID
    strOrder_ID = "00078275"
    Dim intRecordCount
    intRecordCount = Check_Header_RecordCount("",strOrder_ID)
    Response.Write("<br> Header intRecordCount: " & intRecordCount)

    Function Check_Header_RecordCount(strShipTo, strAS400_ID)
    Const adOpenStatic = 3
    Dim strDSN
    strDSN =
    "DATABASE=IBMDA400.DataSource.1;UID=TESTUSER;PWD=T EST;DSN=TESTDSN"
    Dim intRST
    intRST = -1
    Dim strSQL
    strSQL = "SELECT * FROM " & strAS400File & ".IHWEBHUP
    strSQL = strSQL & " WHERE CF05AB = '" & strShipTo & "'"
    strSQL = strSQL & " AND ORD#AB = '" & strAS400_ID & "'"
    Response.Write("<br> strSQL = " & strSQL)
    Dim objRST
    Set objRST = CreateObject("ADODB.Recordset")
    objRST.Open strSQL, strDSN, adOpenStatic
    intRST = objRST.RecordCount
    objRST.Close
    Set objRST = Nothing
    Response.Write("<br> intRST = " & intRST)
    Check_Header_RecordCount = intRST
    End Function
    %>


    McKirahan Guest

  4. #3

    Default Re: ADO/Function Confusion

    "McKirahan" <News@McKirahan.com> wrote in message news:<koUkb.597276$Oz4.592267@rwcrnsc54>...
    > "John Shaw" <jmshaw@weir.net> wrote in message
    > news:91422298.0310200727.3b11b003@posting.google.c om...
    > > Hi, I'm baffled and frustrated.
    > >
    > > I'm working on an export process from my web server to our mainframe.
    > > I can't get the function below to work within the export process.
    > > When I strip it out and runit by itself(see below), it works. In the
    > > file where I need it to work, it doesn't. I'm sure the values are
    > > being passed. The function seems to choke on the rstMain.Open line.
    > > It won't do a response.write after that.
    > >
    > > I assume something in the rest of my code is interfering. Can you
    > > suggest things that might cause this problem? Thanks
    > >
    > > John
    > >
    > >
    > > <%
    > > Dim intRecordCount
    > > Dim strAS400File
    > > Dim strOrder_ID
    > >
    > > strOrder_ID = "00078275"
    > > strAS400File = "TEST"
    > > intRecordCount = Check_Header_RecordCount("",strOrder_ID)
    > > Response.write("Header intRecordCount: " & intRecordCount & "<br>")
    > > %>
    > >
    > > <%
    > > Function Check_Header_RecordCount(strShipTo, strAS400_ID)
    > >
    > > Dim rstMain
    > > set rstMain = CreateObject("ADODB.Recordset")
    > > rstMain.CursorLocation = 3
    > > rstMain.Open "SELECT * FROM " & strAS400File & ".IHWEBHUP WHERE
    > > CF05AB='" & strShipTo & "' AND ORD#AB='" & strAS400_ID &"'", _
    > > "DATABASE=IBMDA400.DataSource.1;UID=TESTUSER;PWD=T EST;DSN=TESTDSN"
    > >
    > > Check_Header_RecordCount = rstMain.RecordCount
    > >
    > > rstMain.close
    > >
    > > End Function
    > > %>
    >
    > This is just a variation of your code -- does it work?
    >
    > <% Option Explicit
    > Dim strAS400File
    > strAS400File = "TEST"
    > Dim strOrder_ID
    > strOrder_ID = "00078275"
    > Dim intRecordCount
    > intRecordCount = Check_Header_RecordCount("",strOrder_ID)
    > Response.Write("<br> Header intRecordCount: " & intRecordCount)
    >
    > Function Check_Header_RecordCount(strShipTo, strAS400_ID)
    > Const adOpenStatic = 3
    > Dim strDSN
    > strDSN =
    > "DATABASE=IBMDA400.DataSource.1;UID=TESTUSER;PWD=T EST;DSN=TESTDSN"
    > Dim intRST
    > intRST = -1
    > Dim strSQL
    > strSQL = "SELECT * FROM " & strAS400File & ".IHWEBHUP
    > strSQL = strSQL & " WHERE CF05AB = '" & strShipTo & "'"
    > strSQL = strSQL & " AND ORD#AB = '" & strAS400_ID & "'"
    > Response.Write("<br> strSQL = " & strSQL)
    > Dim objRST
    > Set objRST = CreateObject("ADODB.Recordset")
    > objRST.Open strSQL, strDSN, adOpenStatic
    > intRST = objRST.RecordCount
    > objRST.Close
    > Set objRST = Nothing
    > Response.Write("<br> intRST = " & intRST)
    > Check_Header_RecordCount = intRST
    > End Function
    > %>
    Nope, this is what I get.

    strSQL = SELECT * FROM TEST.IHWEBHUP WHERE CF05AB = '' AND ORD#AB = '00078275'
    intRST = -1
    Header intRecordCount: -1
    John Shaw Guest

  5. #4

    Default Re: ADO/Function Confusion

    "John Shaw" <jmshaw@weir.net> wrote in message
    news:91422298.0310201914.2f84c93d@posting.google.c om...
    > "McKirahan" <News@McKirahan.com> wrote in message
    news:<koUkb.597276$Oz4.592267@rwcrnsc54>...
    > > "John Shaw" <jmshaw@weir.net> wrote in message
    > > news:91422298.0310200727.3b11b003@posting.google.c om...
    > > > Hi, I'm baffled and frustrated.
    > > >
    > > > I'm working on an export process from my web server to our mainframe.
    > > > I can't get the function below to work within the export process.
    > > > When I strip it out and runit by itself(see below), it works. In the
    > > > file where I need it to work, it doesn't. I'm sure the values are
    > > > being passed. The function seems to choke on the rstMain.Open line.
    > > > It won't do a response.write after that.
    > > >
    > > > I assume something in the rest of my code is interfering. Can you
    > > > suggest things that might cause this problem? Thanks
    > > >
    > > > John
    > > >
    > > >
    > > > <%
    > > > Dim intRecordCount
    > > > Dim strAS400File
    > > > Dim strOrder_ID
    > > >
    > > > strOrder_ID = "00078275"
    > > > strAS400File = "TEST"
    > > > intRecordCount = Check_Header_RecordCount("",strOrder_ID)
    > > > Response.write("Header intRecordCount: " & intRecordCount & "<br>")
    > > > %>
    > > >
    > > > <%
    > > > Function Check_Header_RecordCount(strShipTo, strAS400_ID)
    > > >
    > > > Dim rstMain
    > > > set rstMain = CreateObject("ADODB.Recordset")
    > > > rstMain.CursorLocation = 3
    > > > rstMain.Open "SELECT * FROM " & strAS400File & ".IHWEBHUP WHERE
    > > > CF05AB='" & strShipTo & "' AND ORD#AB='" & strAS400_ID &"'", _
    > > > "DATABASE=IBMDA400.DataSource.1;UID=TESTUSER;PWD=T EST;DSN=TESTDSN"
    > > >
    > > > Check_Header_RecordCount = rstMain.RecordCount
    > > >
    > > > rstMain.close
    > > >
    > > > End Function
    > > > %>
    > >
    > > This is just a variation of your code -- does it work?
    > >
    > > <% Option Explicit
    > > Dim strAS400File
    > > strAS400File = "TEST"
    > > Dim strOrder_ID
    > > strOrder_ID = "00078275"
    > > Dim intRecordCount
    > > intRecordCount = Check_Header_RecordCount("",strOrder_ID)
    > > Response.Write("<br> Header intRecordCount: " & intRecordCount)
    > >
    > > Function Check_Header_RecordCount(strShipTo, strAS400_ID)
    > > Const adOpenStatic = 3
    > > Dim strDSN
    > > strDSN =
    > > "DATABASE=IBMDA400.DataSource.1;UID=TESTUSER;PWD=T EST;DSN=TESTDSN"
    > > Dim intRST
    > > intRST = -1
    > > Dim strSQL
    > > strSQL = "SELECT * FROM " & strAS400File & ".IHWEBHUP
    > > strSQL = strSQL & " WHERE CF05AB = '" & strShipTo & "'"
    > > strSQL = strSQL & " AND ORD#AB = '" & strAS400_ID & "'"
    > > Response.Write("<br> strSQL = " & strSQL)
    > > Dim objRST
    > > Set objRST = CreateObject("ADODB.Recordset")
    > > objRST.Open strSQL, strDSN, adOpenStatic
    > > intRST = objRST.RecordCount
    > > objRST.Close
    > > Set objRST = Nothing
    > > Response.Write("<br> intRST = " & intRST)
    > > Check_Header_RecordCount = intRST
    > > End Function
    > > %>
    >
    > Nope, this is what I get.
    >
    > strSQL = SELECT * FROM TEST.IHWEBHUP WHERE CF05AB = '' AND ORD#AB =
    '00078275'
    > intRST = -1
    > Header intRecordCount: -1
    Try enclosing ORD#AB in brackets; it may not like "#" : [ORD#AB]

    Also, is ORD#AB numeric; if fo then remove the apostrophes:
    SELECT * FROM TEST.IHWEBHUP WHERE CF05AB = '' AND ORD#AB = 00078275


    McKirahan Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139