SQL Server Compact Edition Nuances

May 21, 2009 at 10:29 AM

Hi, When I used the LINQExtender with SQL Server compact edition. I ran ran into issues with query execution. The AddItem method in SQlQuery.cs executes two queries seperated by a semi colon and the SQl engine failed to parse the query. I modified the method shown below and it worked. Is there a better way to resolve this or am I missing something?


protected override bool AddItem()
            bool status = false;

            string sql = Bucket.Instance.Translate(new TSqlFormatProvider());

            //Check if multiple queries need to be executed
            if (sql.Contains(";"))
                //Parse the string into seperate queries and executed them.
                string[] delimiters = new string[] { ";" };
                string[] queries = sql.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
                foreach (string sqlQuery in queries)
                    status = ExecuteReaderAndFillBucket(sqlQuery);
                status = ExecuteReaderAndFillBucket(sql);
            return (status);

May 23, 2009 at 5:51 AM

Nope you just did the right thing :-).