Results 1 to 3 of 3

Thread: RESOLVED!! Missing fields from AS400 query

  1. #1

    Thread Starter
    Hyperactive Member ARPRINCE's Avatar
    Join Date
    Mar 2003
    Location
    Pinoy in NJ
    Posts
    381

    RESOLVED!! Missing fields from AS400 query

    I am testing how long to make an info lookup for account numbers, item#s, etc. to our AS400. Below is a part of my code:

    VB Code:
    1. Label3.Text = TimeString   'START TIME
    2.         Dim dataCON2 As New OdbcConnection("Provider=MSDASQL;DSN=JDE;SYSTEM=XXXX;
    3.               UID=XXXX;Password=XXXX;DBQ=XXXX")
    4.         dataCON2.Open()
    5.         Dim dataCMD2 As New OdbcCommand("SELECT IMITM, IMLITM, MAITM, IMDSC1,
    6.               IMDSC2 FROM F4101 WHERE IMLITM = '" & Textbox2.Text & "'", dataCON2)
    7.  
    8.         Dim dataREADER2 As OdbcDataReader = dataCMD2.ExecuteReader(System.Data.CommandBehavior.CloseConnection)
    9.         Label4.Text = TimeString 'END TIME
    10.  
    11.         DataGrid2.DataSource = dataREADER2
    12.         DataGrid2.DataBind()



    When I run the query with a valid item# entered into TEXTBOX2 , I get the correct record back but I always lose the fields IMLITM and IMAITM. What I can't figure is the sample query is based on a condition where IMLITM = TEXTBOX2 and yet, this field is left out when displayed on the datatgrid.

    When I debug the datareader to show me what's the value of my field, I get this for IMLITM and IMAITM:
    _____________
    ?datareader2.GetValue(1)
    {System.Array}
    (0): 247
    (1): 240.... until .... (24): 64
    _____________

    It's coming out as an array when it has a character type definition in AS400. Anyone has an idea why this is so?

    Thanks
    Last edited by ARPRINCE; Feb 19th, 2004 at 10:50 AM.

  2. #2

    Thread Starter
    Hyperactive Member ARPRINCE's Avatar
    Join Date
    Mar 2003
    Location
    Pinoy in NJ
    Posts
    381
    I investigated a little further this problem. Using VB6 and ADODC1 control, I run the same query binded into a datagrid. It returns me all the fields compared to the VB.NET datagrid. However, the data is displayed as special characters (For example, field IMLITM and IMAITM is shown as "|||||||||@").

    When checking for the field type, it is giving me "128 or Binary Data" when it is defined as alphanumeric in AS400.

    VB Code:
    1. ?adodc1.Recordset.Fields(0).Type   'IMITM  as adNumeric
    2.  131
    3. ?adodc1.Recordset.Fields(1).Type   'IMLITM as adBinary*
    4.  128
    5. ?adodc1.Recordset.Fields(2).Type   'IMLITM as adBinary*
    6.  128
    7. ?adodc1.Recordset.Fields(3).Type   'IMDSC1 as asChar
    8.  129
    9. ?adodc1.Recordset.Fields(4).Type   'IMDCS2 as adChar
    10.  129
    Anyone have ideas? This is driving me nuts!

  3. #3

    Thread Starter
    Hyperactive Member ARPRINCE's Avatar
    Join Date
    Mar 2003
    Location
    Pinoy in NJ
    Posts
    381

    Smile

    OK. I finally got this one fixed. On my ODBC setup for my IBM client access and under the translation tab, I placed a check on Convert Binary Data (CCSID 65535) to text and that did it!

Posting Permissions

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



Click Here to Expand Forum to Full Width