Results 1 to 5 of 5

Thread: [RESOLVED] Dapper.StrongName error "parsing column system.byte[]"

  1. #1

    Thread Starter
    PowerPoster make me rain's Avatar
    Join Date
    Sep 2008
    Location
    india/Hubli
    Posts
    2,205

    Resolved [RESOLVED] Dapper.StrongName error "parsing column system.byte[]"

    with MySQL + Dapper.StrongNamed (i am newbie to dapper please )

    i am getting the error while initializing the Model class from a stored procedure
    here is the stored procedure, the noticeable thing the procedure is function
    Fn_EncDec which De-crypts the user name and password

    Code:
    SELECTbs_basicusers.fullname,
    bs_basicusers.emailid,
    bs_basicusers.phonenumber,
    Fn_EncDec(bs_basicusers.loginName,1) AS loginName ,
    Fn_EncDec(bs_basicusers.userpwd,1) AS userpwd ,
    bs_basicusers.userintro,
    bs_basicusers.bindclient,
    bs_basicusers.systemmac,
    bs_basicusers.userrole,
    bs_basicusers.approval,
    bs_basicusers.Deo,
    bs_basicusers.userid_pk
    FROM bs_basicusers
    ;
    Here is my Model class
    c# Code:
    1. namespace GoApp.Models{
    2.     class BasicUsersModel
    3.     {
    4.         /*
    5. fullname    varchar 150
    6. emailid varchar 50
    7. phonenumber varchar 12
    8. loginName   varchar 150
    9. userpwd varchar 150
    10. userintro   varchar 100
    11. bindclient  enum    0
    12. systemmac   varchar 50
    13. userrole    enum    0
    14. approval    enum    0
    15. Deo varchar 150
    16. LogTime datetime    0
    17. userid_pk   smallint    4
    18.  
    19.  
    20.          */
    21.  
    22.  
    23.         public String fullname { get; set; }
    24.         public String emailid { get; set; }
    25.         public String phonenumber { get; set; }
    26.         public String loginName { get; set; }
    27.         public String userpwd { get; set; }
    28.         public String userintro { get; set; }
    29.         public String bindclient { get; set; }
    30.         public String systemmac { get; set; }
    31.         public String userrole { get; set; }
    32.         public String approval { get; set; }
    33.         public String Deo { get; set; }
    34.         public Int16? userid_pk { get; set; }
    35.     }
    36. }
    Here is my DataAccess Method
    C# Code:
    1. public List<T> GetData<T>(String UDP, DynamicParameters Param = null)        {
    2.             if (!globals.GlobalVars.IsConnectionStringInitialized)
    3.             {
    4.                 throw new Exception("Application Connection not initialized");
    5.             }
    6.  
    7.  
    8.             using (IDbConnection GoAppConnection = new MySqlConnection(globals.GlobalVars.GlobalConnectionString))
    9.             {              
    10.  
    11.  
    12.                 try
    13.                 {
    14.                     if (Param == null)
    15.                     {
    16.                        //Here getting the error
    17.                         return GoAppConnection.Query<T>(UDP).ToList();
    18.                     }
    19.                     else
    20.                     {
    21.                         return GoAppConnection.Query<T>(UDP, Param).ToList();
    22.                     }
    23.  
    24.  
    25.  
    26.  
    27.                 }
    28.                 catch (Exception Ex)
    29.                 {
    30.                     GoAppLibrary.Display.InformationDisplay.InfoMsg(Ex.Message);
    31.                     return null;
    32.                 }
    33.             }
    34.         }

    but i am getting the error
    Error parsing column 3 (loginName=System.Byte[] - Object)
    what is going wrong here
    The averted nuclear war
    My notes:

    PrOtect your PC. MSDN Functions .OOP LINUX forum
    .LINQ LINQ videous
    If some one helps you please rate them with out fail , forum doesn't expects any thing other than this

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    106,895

    Re: Dapper.StrongName error "parsing column system.byte[]"

    What does your Fn_EncDec function return?

  3. #3
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    4,683

    Re: Dapper.StrongName error "parsing column system.byte[]"

    Don't know anything about dapper, did notice,

    Code:
    SELECTbs_basicusers.fullname,
    No space between SELECT bs_basicusers.fullname

  4. #4
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    106,895

    Re: Dapper.StrongName error "parsing column system.byte[]"

    Encryption/decryption is not performed on text but rather on binary data, i.e. bytes. What I suspect is happening is that the Fn_EncDec function is receiving binary data and returning binary data, which means that you will get that data as a byte array. It's then up to you to use an appropriate Encoding object to convert that binary data into text. If you want to get text from the database then you would have include the conversion part in your sproc somehow.

  5. #5

    Thread Starter
    PowerPoster make me rain's Avatar
    Join Date
    Sep 2008
    Location
    india/Hubli
    Posts
    2,205

    Re: Dapper.StrongName error "parsing column system.byte[]"

    Srry for the late reply
    thanks a lot, the function it was returning binary data
    thanks for the solution
    The averted nuclear war
    My notes:

    PrOtect your PC. MSDN Functions .OOP LINUX forum
    .LINQ LINQ videous
    If some one helps you please rate them with out fail , forum doesn't expects any thing other than this

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