当前位置: 首页>>代码示例>>C#>>正文


C# SqlTypes.SqlXml类代码示例

本文整理汇总了C#中System.Data.SqlTypes.SqlXml的典型用法代码示例。如果您正苦于以下问题:C# SqlXml类的具体用法?C# SqlXml怎么用?C# SqlXml使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SqlXml类属于System.Data.SqlTypes命名空间,在下文中一共展示了SqlXml类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetCapacity

 override public void SetCapacity(int capacity) {
     SqlXml[] newValues = new SqlXml[capacity];
     if (null != values) {
         Array.Copy(values, 0, newValues, 0, Math.Min(capacity, values.Length));
     }
     values = newValues;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:SqlXmlStorage.cs

示例2: XMLRecordNewAttribute

    public static String XMLRecordNewAttribute(SqlXml DataXml, String ATag, String AAttributeName, String AAttributeValue)
    {
        if (DataXml.IsNull) return null;

        if(String.IsNullOrWhiteSpace(ATag))
          throw new System.Exception("Parameter @Tag can't be null or empty");

        if(String.IsNullOrWhiteSpace(AAttributeName))
          throw new System.Exception("Parameter @AttributeName can't be null or empty");

        if(AAttributeValue == null) //return DataXml.Value;
          throw new System.Exception("Parameter @AttributeValue can't be null");

        XmlDocument UpdateDoc = new XmlDocument();
        XmlNode UpdateRoot = UpdateDoc.CreateElement("RECORDS");
        UpdateRoot.InnerXml = DataXml.Value;

        for(int I = 0; I < UpdateRoot.ChildNodes.Count; I++)
        {
          XmlNode UpdateNode = UpdateRoot.ChildNodes[I];
          if(UpdateNode.LocalName == ATag)
          {
        XmlAttribute Attribute = UpdateDoc.CreateAttribute(AAttributeName);
        Attribute.Value = AAttributeValue;
        UpdateNode.Attributes.Append(Attribute);
          }
        }

        return UpdateRoot.ChildNodes.Count == 0 ? null : UpdateRoot.InnerXml;
    }
开发者ID:APouchkov,项目名称:ExtendedStoredProcedures,代码行数:30,代码来源:XmlRecords.cs

示例3: ExecScript

        public static SqlXml ExecScript(SqlString Sql, SqlXml Options, SqlXml Input)
        {
            var XOutput = new XDocument(
                new XElement("root",
                    new XElement("content")));

            try
            {
                using (var q = new SqlCommand())
                {
                    q.Connection = new SqlConnection("context connection=true");
                    q.CommandType = CommandType.Text;

                    q.CommandText = Sql.Value;
                    q.InitOptions(Options.Value);
                    q.Parameters.SetInput(Input.Value);

                    q.Connection.Open();
                    q.ExecuteNonQuery();
                    XOutput.Root.Add(q.Parameters.GetOutput());
                    q.Connection.Close();
                }
            }
            catch (Exception ex)
            {
                XOutput.Root.Add(ex.ExceptionSerialize());
            }

            return new SqlXml(XOutput.CreateReader());
        }
开发者ID:PeletonSoft,项目名称:Assemblies,代码行数:30,代码来源:ExternalXML.cs

示例4: DefaultStoreSchemaInfo

 /// <summary>
 /// Constructs the storage representation from client side objects.
 /// </summary>
 /// <param name="name">Schema info name.</param>
 /// <param name="shardingSchemaInfo">Schema info represented in XML.</param>
 internal DefaultStoreSchemaInfo(
     string name,
     SqlXml shardingSchemaInfo)
 {
     this.Name = name;
     this.ShardingSchemaInfo = shardingSchemaInfo;
 }
开发者ID:CrossPoint,项目名称:elastic-db-tools,代码行数:12,代码来源:DefaultStoreSchemaInfo.cs

示例5: Constructor2_Stream_Empty

 [Fact] // .ctor (Stream)
 public void Constructor2_Stream_Empty()
 {
     MemoryStream ms = new MemoryStream();
     SqlXml xmlSql = new SqlXml(ms);
     Assert.False(xmlSql.IsNull);
     Assert.Equal(string.Empty, xmlSql.Value);
 }
开发者ID:dotnet,项目名称:corefx,代码行数:8,代码来源:SqlXmlTest.cs

示例6: ExecQuery

        public static SqlXml ExecQuery(SqlString Sql, SqlXml Options, SqlXml Input)
        {
            var XOutput = new XDocument(new XElement("root"));

            try
            {
                using (var q = new SqlCommand())
                {
                    q.Connection = new SqlConnection("context connection=true");
                    q.CommandType = CommandType.Text;

                    q.CommandText = Sql.Value;
                    q.InitOptions(Options.Value);
                    q.Parameters.SetInput(Input.Value);

                    q.Connection.Open();
                    var Result = q.ExecuteXmlReader();
                    if (Result.Read())
                        XOutput.Root.Element("content").Add(
                            XElement.Load(Result, LoadOptions.None));
                    q.Connection.Close();
                }
            }
            catch (Exception ex)
            {
                XOutput.Root.Add(ex.ExceptionSerialize());
            }

            return new SqlXml(XOutput.CreateReader());
        }
开发者ID:PeletonSoft,项目名称:Assemblies,代码行数:30,代码来源:ExternalXML.cs

示例7: GetXml

 /// <summary>
 /// Return XML for an array of items
 /// </summary>
 /// <param name="List">List of items</param>
 /// <param name="ListName">Name of the list</param>
 /// <param name="ItemName">Name of the item in the list.</param>
 /// <returns></returns>
 public static SqlXml GetXml(IEnumerable List, string ListName, string ItemName)
 {
     //We don't use 'using' or dispose or close the stream,
     //since it leaves in the return variable
     MemoryStream stream = new MemoryStream();
     SqlXml Result = null;
     try
     {
         using (XmlWriter writer = XmlWriter.Create(stream))
         {
             writer.WriteStartElement(ListName);
             foreach (object obj in List)
             {
                 writer.WriteElementString(ItemName, obj.ToString());
             }
             writer.WriteEndElement();
             Result = new SqlXml(stream);
         }
     }
     catch (Exception ex)
     {
         throw (ex);
     }
     finally
     {
     }
     return Result;
 }
开发者ID:lxalln,项目名称:reflect-orm,代码行数:35,代码来源:DatabaseXMLUtilities.cs

示例8: ParamDateTimeTemp

 public static SqlDateTime ParamDateTimeTemp(SqlXml Xml, SqlString Name)
 {
     String ValueType;
       String Value = GetValueFromXMLAttribute(Xml, Name, out ValueType);
       if (Value == null) return new SqlDateTime();
       SqlDateTime Result;
       try
       {
     Result = new SqlDateTime(XmlConvert.ToDateTime(Value, XmlDateTimeSerializationMode.RoundtripKind));
       }
       catch (Exception Error)
       {
     throw new System.Exception("Error convert Param = \"" + Name.Value.ToString() + "\" Value = \"" + Value.ToString() + "\" to DateTime: " + Error.Message);
       }
       if (ValueType != null && ValueType != "")
       {
     // year, month, day, hour, minute, second
     switch (ValueType)
     {
       case "1": return Result.Value.Date.AddDays(1);
       default: return Result;
     }
       }
       return Result;
 }
开发者ID:APouchkov,项目名称:ExtendedStoredProcedures,代码行数:25,代码来源:XmlParams.cs

示例9: SqlTriggerContext

		internal SqlTriggerContext (TriggerAction triggerAction, bool[] columnsUpdated, 
					SqlXml eventData)
		{
			this.triggerAction = triggerAction;
			this.columnsUpdated = columnsUpdated;
			this.eventData = eventData;
		}
开发者ID:jamescourtney,项目名称:mono,代码行数:7,代码来源:SqlTriggerContext.cs

示例10: XMLRecordInnerXml

    public static String XMLRecordInnerXml(SqlXml AXml, String ATag)
    {
        XmlReader LReader = AXml.CreateReader();
        LReader.Read();
        while(!LReader.EOF)
        {
          if(LReader.NodeType == XmlNodeType.Element)
          {
        if (LReader.Name == ATag)
        {
          String LInnerXml = LReader.ReadInnerXml();
          if (String.IsNullOrWhiteSpace(LInnerXml))
            return null;
          else
            return LInnerXml;
        }
        else
        {
          if (!LReader.IsEmptyElement)
            LReader.Skip();
          else
            LReader.Read();
        }
          }
          else
        LReader.Read();
        }

        return null;
    }
开发者ID:APouchkov,项目名称:ExtendedStoredProcedures,代码行数:30,代码来源:XmlRecords.cs

示例11: Constructor2_Stream_ASCII

		public void Constructor2_Stream_ASCII ()
		{
			string xmlStr = "<Employee><FirstName>Varadhan</FirstName><LastName>Veerapuram</LastName></Employee>";
			MemoryStream stream = new MemoryStream (Encoding.ASCII.GetBytes (xmlStr));
			SqlXml xmlSql = new SqlXml (stream);
			Assert.IsFalse (xmlSql.IsNull, "#1");
			Assert.AreEqual (xmlStr, xmlSql.Value, "#2");
		}
开发者ID:nlhepler,项目名称:mono,代码行数:8,代码来源:SqlXmlTest.cs

示例12: CreateActivity

        public static void CreateActivity(SqlString url, SqlString username, SqlString password, SqlString token, SqlString employeeId, SqlXml messageBlob)
        {
            IChatterService service = new ChatterService(url.Value);
            service.AllowUntrustedConnection();
            service.Login(username.Value, password.Value, token.Value);

            CreateProfileActivity(service, employeeId.Value, messageBlob.Value);
        }
开发者ID:anirvan,项目名称:gadgets,代码行数:8,代码来源:ChatterSqlProcedures.cs

示例13: Constructor2_Stream_Unicode

 [Fact] // .ctor (Stream)
        //[Category ("NotDotNet")] // Name cannot begin with the '.' character, hexadecimal value 0x00. Line 1, position 2
 public void Constructor2_Stream_Unicode()
 {
     string xmlStr = "<Employee><FirstName>Varadhan</FirstName><LastName>Veerapuram</LastName></Employee>";
     MemoryStream stream = new MemoryStream(Encoding.Unicode.GetBytes(xmlStr));
     SqlXml xmlSql = new SqlXml(stream);
     Assert.False(xmlSql.IsNull);
     Assert.Equal(xmlStr, xmlSql.Value);
 }
开发者ID:dotnet,项目名称:corefx,代码行数:10,代码来源:SqlXmlTest.cs

示例14: SaveXMLTofile

    public static void SaveXMLTofile(SqlXml XMLData, String DestFile, Boolean Append)
    {
        StreamWriter writer = new StreamWriter(DestFile, Append, System.Text.Encoding.UTF8);
        writer.Write(@"<?xml version=""1.0"" encoding=""utf-8"" ?>");
        writer.Write(XMLData.Value);
        writer.Close();

        SqlContext.Pipe.Send(String.Format("XML text successfully saved to file '{0}'", DestFile));
    }
开发者ID:gipasoft,项目名称:Sfera,代码行数:9,代码来源:SaveXMLTofile.cs

示例15: TestCreateActivityWithMissingBody

        public void TestCreateActivityWithMissingBody()
        {
            string xml =
                "<activity xmlns=\"http://ns.opensocial.org/2008/opensocial\"><postedTime>1310597396000</postedTime><title>Edited their narrative</title></activity>";
            var xmlReader = XmlTextReader.Create(new System.IO.StringReader(xml));

            SqlXml messageBlob = new SqlXml(xmlReader);

            //ChatterSqlProcedures.CreateActivity(_url, _username, _password, _token, _employeeId, messageBlob, _pmid, _title, _body);
        }
开发者ID:CTSIatUCSF,项目名称:gadgets,代码行数:10,代码来源:ChatterSqlProceduresTest.cs


注:本文中的System.Data.SqlTypes.SqlXml类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。