Tuesday, 24 May 2016

c# node.selectnodes add attribute

   Item objItem = _inn.newItem("Identity", "get");
            Item logicItm = objItem.newOR();

            logicItm.setProperty("name", "%Admin%");
            logicItm.setProperty("name", "%Author%");

            Item iChildren = objItem.getLogicalChildren();
            for (int i = 0; i < iChildren.getItemCount(); i++)
            {
                Item iChild = iChildren.getItemByIndex(i);
   
                XmlDocument objXDoc = new XmlDocument();
                XmlAttribute objNewAtt = objXDoc.CreateAttribute("condition");
                objNewAtt.Value = "like";

                XmlNodeList allNames = iChild.node.SelectNodes("name");
                foreach (XmlNode eachName in allNames)
                {
                    eachName.Attributes.SetNamedItem(objNewAtt);
                }

            }
            Item retItm = objItem.apply();

Tuesday, 17 May 2016

How can I get column names from a table in SQL Server?

SELECT * FROM sys.columns WHERE object_id = OBJECT_ID('dbo.yourTableName')


or

  SELECT *
FROM INFORMATION_SCHEMA.COLUMNS
WHERE
     TABLE_NAME  ='MyTable'
      AND
      TABLE_CATALOG='MyDBName'

Wednesday, 4 May 2016