• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# SqlTypes.SqlXml类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: TestRandomUnicodeGeneration_ExecutesSuccessfully

 public void TestRandomUnicodeGeneration_ExecutesSuccessfully()
 {
     XmlDocument xmlDocument = new XmlDocument();
     XmlElement xmlNode = xmlDocument.CreateElement("TestNode");
     // ReSharper disable once AssignNullToNotNullAttribute
     xmlNode.InnerText = Random.RandomString(100000);
     xmlDocument.AppendChild(xmlNode);
     XmlNodeReader xmlNodeReader = new XmlNodeReader(xmlDocument);
     // The SqlXml constructor applies stricter tests to Unicode strings than Encoding.Unicode:
     // ReSharper disable once UnusedVariable
     SqlXml dummy = new SqlXml(xmlNodeReader);
 }
开发者ID:webappsuk,项目名称:CoreLibraries,代码行数:12,代码来源:TestUnicode.cs


示例17: buttonSend_Click

        private void buttonSend_Click(object sender, EventArgs e)
        {
            richTextBoxResponseHeader.Text = "";
            richTextBoxResponseBody.Text = "";
            var header = richTextBoxHeader.Text.Length > 0 ? new SqlXml(XmlReader.Create(new StringReader(richTextBoxHeader.Text))) : SqlXml.Null;
            var body = new SqlXml(XmlReader.Create(new StringReader(richTextBoxBody.Text)));

            Sql.UDF.SOAPRequest.SOAP.SOAPRequest((SqlString)textBoxUri.Text, ref header, ref body);

            richTextBoxResponseHeader.Text = header.IsNull == false ? header.Value : "" ;
            richTextBoxResponseBody.Text = body.IsNull == false ? body.Value : "";
        }
开发者ID:APouchkov,项目名称:ExtendedStoredProcedures,代码行数:12,代码来源:FormMain.cs


示例18: Constructor2_Stream_Null

        public void Constructor2_Stream_Null()
        {
            SqlXml xmlSql = new SqlXml((Stream)null);
            Assert.True(xmlSql.IsNull);

            try
            {
                string value = xmlSql.Value;
                Assert.False(true);
            }
            catch (SqlNullValueException)
            {
            }
        }
开发者ID:dotnet,项目名称:corefx,代码行数:14,代码来源:SqlXmlTest.cs


示例19: ParamDateTime

 public static DateTime? ParamDateTime(SqlXml Xml, SqlString Name)
 {
     String Value = GetValueFromXML(Xml, Name);
       if (Value == null)
     return null;
       else
     try
     {
       return XmlConvert.ToDateTime(Value, XmlDateTimeSerializationMode.RoundtripKind);
     }
     catch (Exception Error)
     {
       throw new System.Exception("Error convert Param = \"" + Name.Value + "\" Value = \"" + Value + "\" to DateTime: " + Error.Message);
     }
 }
开发者ID:APouchkov,项目名称:ExtendedStoredProcedures,代码行数:15,代码来源:XmlParams.cs


示例20: ParamBit

 public static SqlBoolean ParamBit(SqlXml Xml, SqlString Name)
 {
     String Value = GetValueFromXML(Xml, Name);
       if (Value == null)
     return new SqlBoolean();
       else
     try
     {
       return new SqlBoolean(XmlConvert.ToBoolean(Value));
     }
     catch (Exception Error)
     {
       throw new System.Exception("Error convert Param = \"" + Name.Value.ToString() + "\" Value = \"" + Value.ToString() + "\" to Boolean: " + Error.Message);
     }
 }
开发者ID:APouchkov,项目名称:ExtendedStoredProcedures,代码行数:15,代码来源:XmlParams.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Diagnostics.CounterCreationData类代码示例发布时间:2022-05-26
下一篇:
C# SqlTypes.SqlString类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap