Quantcast
Channel: C1 CMS Foundation - Open Source on .NET
Viewing all articles
Browse latest Browse all 2540

New Post: How would I rewrite this Sql update statement to work in C1 c# ?

$
0
0
Hi,
I have a piece of code in an image sortable grid which sends back a resulting string array of integers based on the user's new sort order for 'propid':

{ 'imgid': '2,3,4,5,6,7,8,9,1','propid':'391' }

The above shows 9 images on the screen. The db image table has both an image id (imgid) field and a sort sequence field (orderseq).

In direct Sql I would write this:
string []q = imgid.Split(',');
        string qry="";
        for (int i = 0; i < q.Length; i++)
        {
            qry += "update ALocal_propimage set propimage_orderseq="+(i+1)+"  where  prop_id="+propid+" and  propimage_id="+q[i]+"  ;";
        }
        sqlHelper obj = new sqlHelper();
        obj.ExecuteNonQuery(qry);
        return "Record Updated";
How does this convert to writing it using c# into the C1 Updating Multiple Data method as I keep failing at it?

Viewing all articles
Browse latest Browse all 2540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>