PetaPoco multi-table join with custom datafield

103 views Asked by At

I used PetaPoco.Compiled 6.0.441... I want to select data from two tables with inner join ...

always give me error msg

System.InvalidCastException: Object must implement IConvertible.

pls. help me ...

the code as following ..

 [TableName("S_SEQ_LOG")]
    class S_SEQ_LOG
    {

        public string gSeqLogId { get; set; }

        public string iYear { get; set; }
        public string iMonth { get; set; }
        public string iDay { get; set; }
        public string iCurrentVal { get; set; }

        public string vTableNm { get; set; }

         [Ignore]
        public S_SEQ_RULE ssr { get; set; }
    }
    [TableName("S_SEQ_RULE")]
    class S_SEQ_RULE
    {

        public string vTableNm { get; set; }
        public string vRule { get; set; }
        public string vPrefix { get; set; }
        public string iLength { get; set; }
        public string iCurrentVal { get; set; }

    }
 var db = DbManager.Create("SqlServer");

            var posts = db.Fetch<S_SEQ_LOG, S_SEQ_RULE, S_SEQ_LOG>(
                (a, b) =>
                      { a.ssr = b; return a; }
                 ,
                        @"SELECT A.*,B.*
                        FROM S_SEQ_LOG  A INNER JOIN S_SEQ_RULE B ON
        A.vTableNm=B.vTableNm
                        ");
0

There are 0 answers