Problem converting Russian Characters in my Data Adapter RRS feed

  • Question


    I have written a data collection app in VS 2005  using VB.


    the application reads a barcode from a Receiving Tag which was printed from an AS/400 program.


    The AS/400 prog has stored the Russian characters as part numbers.


    This retrieves the characters correctly to my application.  I then transfer them to another dataset in my program

    along with some other info entered by the user and send it back to the AS/440 to a different file to be proccessed (Issued to a Work Order.


    I have also created an On screen keyboard that also gives the user the ability to type in Russian characters.


    The problem I am facing is that when I have loaded my dataset and try to write to a fileon the AS/400 I get an error saying,


  Valkue of the parameter XPART could not be converted to the Host data Type


    Has anyone come across an error like this before ?


    does anyone have any ideas on a resolution ?








    Monday, June 23, 2008 6:26 PM

All replies

  • Do you get same exception when you try to store non-Russian characters? Based on message you have posted it looks like that data type of the column in database table does not match to the datatype of the parameter you have declared in your code. Do you know what datatype you have in a database column? Can you post code that passes data into database?


    Tuesday, June 24, 2008 10:09 AM
  • I am able to transfer non russian characters with no problem..


    here is the code I am using to populate my dataset, and a layout of my dataset showing the poroperties of each field.


    Code Snippet



    PneT032_DS.Tables(0).Rows(0).Item(0) = CreateDate(Now().ToShortDateString) 'Order Date

    PneT032_DS.Tables(0).Rows(0).Item(1) = txtUSER.Text 'User

    PneT032_DS.Tables(0).Rows(0).Item(2) = txtPart.Text 'Part Number

    PneT032_DS.Tables(0).Rows(0).Item(3) = txtQTY.Value 'Qty

    PneT032_DS.Tables(0).Rows(0).Item(4) = txtSN.Text 'Serial Number

    PneT032_DS.Tables(0).Rows(0).Item(5) = txtWHS.Text 'Warehouse

    PneT032_DS.Tables(0).Rows(0).Item(6) = "0"

    PneT032_DS.Tables(0).Rows(0).Item(7) = txtTASK.Text 'Work Order Suffix

    PneT032_DS.Tables(0).Rows(0).Item(8) = txtLPlate.Text 'License Plate Number

    PneT032_DS.Tables(0).Rows(0).Item(9) = " " 'Transferred Flag

    PneT032_DS.Tables(0).Rows(0).Item(10) = "Not Proccessed" 'Error Text

    PneT032_DS.Tables(0).Rows(0).Item(11) = Now().GetHashCode 'Unique Field




    MessageBox.Show("Record was Written to AS/400", "", MessageBoxButtons.OK)



    Catch ex As Exception


    End Try





    XORDDTE              System.Decimal                Max Length  =  -1

    XPART                   System.String                   Max Length  = 20

    XQTY                     System.Decimal                Max Length  = -1

    XSERIAL                Serial.String                      Max Length  = 15

    XWHS                    Serial.String                      Max Length  = 3

    XWO                      Serial.Decimal                   Max Length  = -1

    XTASK                   Serial.Decimal                   Max Length  = -1

    XLPLATE                Serial.Decimal                  Max Length   = -1

    XFERRED              Serial.String                      Max Length   = 1

    XERROR                Serial.String                      Max Length   = 30

    XUNIQUE               Serial.Decimal                   Max Length   = -1

    XTXTYPE               Serial.String                      Max Length   = 1


    Please let me know if you require any other information...






    Tuesday, June 24, 2008 7:30 PM
  • I am suspecting that because your string value contans characters with the code beyond ASCII, provider cannot convert them properly to the type in a database if coluimn in database does nor support Unicode strings. That's just a guess. Do you know which data type that column declared in your database table?


    Wednesday, June 25, 2008 9:39 AM

    The layout of the File on the AS/400 is as folows


    XORDDTE    Pkd   8,0  Date                
    XUSER      Char 10    XUSER               
    XPART      Char 20    Part Number         
    XQTY       Pkd   7,0  Trans no Stockbook  
    XSERIAL    Char 15    Serial number       
    XWHS       Char  3    Warehouse           
    XWO        Pkd   2,0  Work Order part 1   
    XTASK      Pkd   5,0  Work Order part 2   
    XLPLATE    Pkd   9,0  XLPLATE             
    XFERRED    Char  1    XFERRED             
    XERROR     Char 30    XERROR              
    XUNIQUE    Pkd  12,0  XUNIQUE             
    XTXTYPE    Char  1    XTXTYPE             


    Is this what you were asking about ?




    Wednesday, June 25, 2008 3:35 PM
  • XPART is declared as CHAR type, and I believe it will not support Unicode strings. I do not know if AS/400 has specific type for Unicode strings (same as NChar in SQL Server, for example). So you might look into that area. Another potential solution (but again, I am not sure if it would work with AS/400) is to set database encoding to support specific set of characters.
    Friday, June 27, 2008 10:07 AM