Friday, 20 May 2016

XPO Snippets

Session s = new Session();
            s.ConnectionString = "Data Source=(local);Initial Catalog=NORTHWND;Integrated Security=True";
            int i = Convert.ToInt32(s.ExecuteScalar("select count(*) from products where UnitPrice>@price AND ProductName LIKE @prodName", new string[] { "@price","@prodName" }, new object[] { 10,"A%" }));
            MessageBox.Show(i.ToString());
            s.ExecuteNonQuery("UPDATE Products SET ProductName='a_'+ProductName WHERE UnitPrice>@price AND ProductName LIKE 'A%'", new string[] { "@price" }, new object[] { 10 });
            SelectedData sd = s.ExecuteQuery("select * from products where UnitPrice>@price AND ProductName LIKE 'A%'", new string[] { "@price" }, new object[] { 10 });
            MessageBox.Show(sd.ResultSet[0].Rows[0].Values[1].ToString());