2013년 2월 13일 수요일

SqlCeConnection select top 1

SqlCeConnection select top 1



Another gotcha but this time in the dialect that SQL Compact Edition 3.5 uses.

Version 3.5 introduced a couple of new features to make it's SQL more compatible with that of SQL Server and one of those is TOP.

Simple you'd think but oh on - they've decided to use a different dialect for the same command.

In SQL server you write:

SELECT TOP 10 [name] FROM [people] ORDER BY [name]

In SQL CE 3.6 you write:

SELECT TOP (10) [name] FROM [people] ORDER BY [name]


select top (1) condate from sharedata
order by condate desc




How annoying as it means that the same piece of SQL can't be used without a little translation layer. Why anybody though that wrapping the number of lines in parenthesis was a good idea I'll never know!

sharepoint since GetListItemChanges

sharepoint since GetListItemChanges

변경된 이후의 데이타를 가져온다.


The following code example displays information about items in a list that have been changed after a specified date. The example uses an XmlDocument object to createXmlNode objects for parameters.
This example requires that a using (Visual C#) or Imports (Visual Basic) directive be included for the System.Xml namespace.
Web_Reference_Folder.Lists listService = new Web_Reference_Folder.Lists();
listService.Credentials= System.Net.CredentialCache.DefaultCredentials;

XmlDocument xmlDoc = new System.Xml.XmlDocument();

XmlNode ndViewFields = xmlDoc.CreateNode(XmlNodeType.Element,"ViewFields","");
XmlNode ndContains = xmlDoc.CreateNode(XmlNodeType.Element,"Contains","");

ndViewFields.InnerXml = "<FieldRef Name='Field1'/>" + 
    "<FieldRef Name='Field2'/><FieldRef Name='Field3' />";
ndContains.InnerXml = "<FieldRef Name='Field'/>" + 
    "<Value Type='Number'>Number</Value>";

try
{
   XmlNode ndListChanges = listService.GetListItemChanges("List_Name", 
       ndViewFields, "2003-06-18T00:00:00Z", ndContains);
   MessageBox.Show(ndListChanges.OuterXml);
}

catch (System.Web.Services.Protocols.SoapException ex)
{
    MessageBox.Show("Message:\n" + ex.Message + "\nDetail:\n" + 
            ex.Detail.InnerText + 
        "\nStackTrace:\n" + ex.StackTrace);
}



msdn 정보를 참고하자
http://msdn.microsoft.com/en-us/library/lists.lists.getlistitemchanges(v=office.12).aspx

참고하자
http://msdn.microsoft.com/en-us/library/lists.lists.getlistitemchangessincetoken(v=office.12).aspx