我必须将此SVG文件插入数据库
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 22.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 655 714" style="enable-background:new 0 0 655 714;" xml:space="preserve">
<style type="text/css">
.st0{fill:none;stroke:#000000;stroke-width:0.4252;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;}
.st1{font-family:'ArialMT';}
.st2{font-size:4.4px;}
.st3{font-size:4.0619px;}
.st4{font-size:4.4848px;}
.st5{font-family:'CenturyGothic';}
.st6{font-size:5.3818px;}
.st7{font-size:4.862px;}
.st8{font-size:2.9424px;}
.st9{font-size:5.3817px;}
.st10{font-size:5.5371px;}
.st11{font-family:'FuturaBT-Medium';}
.st12{font-size:7.0621px;}
.st13{font-size:5.6497px;}
</style>
<g id="INSERT_228_">
<g id="POLYLINE">
<polyline class="st0" points="582.3,29.3 489.3,29.3 489.3,161.1 472.8,161.1 472.8,381.8 9.2,381.8 9.2,550.9 91.1,550.9
91.1,688.8 404.2,688.8 404.2,672.1 613.8,672.1 613.8,551 568,551 568,161.9 582.3,161.9 582.3,29.3 "/>
</g>
<g id="SS06">
<rect x="200.3" y="504.5" class="st0" width="76.2" height="38.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 202.121 540.6375)" class="st1 st2">SS06</text>
</g>
<g id="SS22">
<rect x="292.4" y="469.6" class="st0" width="38.1" height="19"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 294.1578 487.368)" class="st1 st2">SS22</text>
</g>
<g id="SS24">
<rect x="292.4" y="504.5" class="st0" width="76.2" height="38.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 294.123 540.6375)" class="st1 st2">SS24</text>
</g>
<g id="SS18">
<rect x="13" y="479.1" class="st0" width="76.2" height="63.5"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 15.1014 540.2482)" class="st1 st2">SS18</text>
</g>
<g id="SS23">
<rect x="330.5" y="469.6" class="st0" width="38.1" height="19"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 357.6646 487.1672)" class="st1 st2">SS23</text>
</g>
<g id="SS21">
<rect x="330.5" y="450.5" class="st0" width="38.1" height="19.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 357.6647 454.7141)" class="st1 st2">SS21</text>
</g>
<g id="SS28">
<rect x="425.8" y="504.5" class="st0" width="38.1" height="38.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 451.0888 540.6377)" class="st1 st2">SS28</text>
</g>
<g id="SS27">
<rect x="387.7" y="504.5" class="st0" width="38.1" height="38.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 389.792 540.9427)" class="st1 st2">SS27</text>
</g>
<g id="SS26">
<rect x="387.7" y="450.5" class="st0" width="78.2" height="38.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 389.7925 487.3685)" class="st1 st2">SS26</text>
</g>
<g id="SS25">
<rect x="387.5" y="396.3" class="st0" width="76.6" height="38.5"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 389.7921 433.5091)" class="st1 st2">SS25</text>
</g>
<g id="SS32">
<rect x="479.7" y="504.5" class="st0" width="76.3" height="38.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 481.5829 540.3324)" class="st1 st2">SS32</text>
</g>
<g id="SS30">
<rect x="479.5" y="396.3" class="st0" width="76.6" height="38.5"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 481.5831 433.5082)" class="st1 st2">SS30</text>
</g>
<g id="SS36">
<rect x="479.7" y="352.1" class="st0" width="25.4" height="19"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 481.5835 370.0043)" class="st1 st2">SS36</text>
</g>
<g id="SS33">
<rect x="479.7" y="333" class="st0" width="25.4" height="19.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 481.5836 337.4037)" class="st1 st2">SS33</text>
</g>
<g id="SS42">
<rect x="517.8" y="298.1" class="st0" width="38" height="19.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 543.9044 315.6991)" class="st1 st2">SS42</text>
</g>
<g id="SS39">
<rect x="479.7" y="279" class="st0" width="38.1" height="38.2"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 481.584 315.6996)" class="st1 st2">SS39</text>
</g>
<g id="SS41">
<rect x="536.8" y="279" class="st0" width="19.1" height="19.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 544.0334 283.5067)" class="st1 st2">SS41</text>
</g>
<g id="SS49">
<rect x="479.7" y="244.3" class="st0" width="19" height="18.5"/>
<text transform="matrix(0.9286 -1.050466e-04 1.204293e-04 1 481.8765 260.9377)" class="st1 st3">SS49</text>
</g>
<g id="SS46">
<rect x="536.8" y="225.1" class="st0" width="19.1" height="19.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 543.6462 229.5146)" class="st1 st2">SS46</text>
</g>
<g id="SS43">
<rect x="479.5" y="224.9" class="st0" width="19.5" height="19.5"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 481.5837 229.515)" class="st1 st2">SS43</text>
</g>
<g id="SS53">
<g>
<rect x="517.8" y="190.1" class="st0" width="38" height="19.1"/>
</g>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 543.9044 207.2685)" class="st1 st2">SS53</text>
</g>
<g id="SS51">
<g>
<rect x="479.7" y="171.1" class="st0" width="38.1" height="19.1"/>
</g>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 481.5843 175.4545)" class="st1 st2">SS51</text>
</g>
<g id="SS38">
<rect x="530.5" y="352.1" class="st0" width="25.3" height="19"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 544.0338 370.1347)" class="st1 st2">SS38</text>
</g>
<g id="SS31">
<rect x="479.7" y="450.5" class="st0" width="76.3" height="38.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 481.5835 487.1674)" class="st1 st2">SS31</text>
</g>
<g id="SS52">
<g>
<rect x="479.7" y="190.1" class="st0" width="38.1" height="19.1"/>
</g>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 482.0323 207.2679)" class="st1 st2">SS52</text>
</g>
<g id="SS35">
<rect x="530.5" y="333" class="st0" width="25.3" height="19.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 543.6471 337.4033)" class="st1 st2">SS35</text>
</g>
<g id="SS16">
<rect x="108" y="450.3" class="st0" width="38.4" height="13.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 111.4612 459.9469)" class="st1 st2">SS16</text>
</g>
<g id="SS09">
<rect x="200.3" y="469.6" class="st0" width="50.8" height="19"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 202.1215 486.5066)" class="st1 st2">SS09</text>
</g>
<g id="SS07">
<rect x="200.3" y="450.5" class="st0" width="50.8" height="19.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 202.121 456.7469)" class="st1 st2">SS07</text>
</g>
<g id="SS19">
<rect x="251.1" y="469.6" class="st0" width="25.4" height="19"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 264.4966 486.5062)" class="st1 st2">SS19</text>
</g>
<g id="SS20">
<rect x="292.4" y="450.5" class="st0" width="38.1" height="19.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 294.1217 454.7146)" class="st1 st2">SS20</text>
</g>
<g id="SS48">
<rect x="498.8" y="244.1" class="st0" width="19.1" height="19.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 504.8678 261.7213)" class="st1 st2">SS48</text>
</g>
<g id="SS44">
<rect x="498.6" y="224.9" class="st0" width="19.5" height="19.5"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 505.4529 229.604)" class="st1 st2">SS44</text>
</g>
<g id="SS47">
<rect x="517.8" y="244.1" class="st0" width="38" height="19.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 543.0709 261.7207)" class="st1 st2">SS47</text>
</g>
<g id="SS45">
<rect x="517.5" y="224.8" class="st0" width="19.5" height="19.5"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 524.3689 229.6047)" class="st1 st2">SS45</text>
</g>
<g id="SS40">
<rect x="517.8" y="279" class="st0" width="19" height="19.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 519.0959 283.5067)" class="st1 st2">SS40</text>
</g>
<g id="SS37">
<rect x="505.1" y="352.1" class="st0" width="25.4" height="19"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 507.9546 370.0031)" class="st1 st2">SS37</text>
</g>
<g id="SS34">
<rect x="505.1" y="333" class="st0" width="25.4" height="19.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 507.9557 337.4035)" class="st1 st2">SS34</text>
</g>
<g id="SS50">
<g>
<rect x="517.8" y="171.1" class="st0" width="38" height="19.1"/>
</g>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 543.2034 175.4541)" class="st1 st2">SS50</text>
</g>
<g id="SS15">
<rect x="146.1" y="450.3" class="st0" width="38.5" height="13.1"/>
<text transform="matrix(0.9 -1.531916e-04 1.702129e-04 1 170.4282 459.9478)" class="st1 st2">SS15</text>
</g>
<g id="SS17">
<rect x="324.2" y="396.5" class="st0" width="19" height="19.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 330.1946 401.6645)" class="st1 st4">SS17</text>
</g>
<g id="SS08">
<rect x="251.1" y="450.5" class="st0" width="25.4" height="19.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 264.4968 455.5882)" class="st1 st2">SS08</text>
</g>
<g id="SS02">
<rect x="108" y="478.9" class="st0" width="76.6" height="63.9"/>
<text transform="matrix(0.9 0 0 1 109.3252 540.248)" class="st1 st2">SS02</text>
</g>
<g id="SS13">
<rect x="324.2" y="415.6" class="st0" width="44.5" height="19.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 354.4122 433.4468)" class="st1 st4">SS13</text>
<text transform="matrix(1.0543 5.501365e-03 -5.217977e-03 1 326.5814 424.6328)" class="st5 st6">Testing Banner</text>
</g>
<g id="SS14">
<rect x="343.2" y="396.4" class="st0" width="25.4" height="19.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 356.1604 401.3343)" class="st1 st4">SS14</text>
<text transform="matrix(1 5.218023e-03 -5.217971e-03 1 344.3441 406.3805)" class="st5 st6">Aqua</text>
</g>
<g id="SS11">
<rect x="238.2" y="396.3" class="st0" width="38.5" height="38.5"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 260.3292 433.241)" class="st1 st4">SS11</text>
<text transform="matrix(1.1069 5.218016e-03 -4.714038e-03 1 239.4776 416.2588)" class="st5 st7">Rich Interiors</text>
</g>
<g id="SS05">
<rect x="200.1" y="396.3" class="st0" width="38.5" height="38.5"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 201.3555 433.036)" class="st1 st4">SS05</text>
<text transform="matrix(1 5.218023e-03 -5.217971e-03 1 209.7535 416.1146)" class="st5 st6">O''Prime</text>
</g>
<g id="SS12">
<rect x="292.4" y="396.5" class="st0" width="31.8" height="38.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 292.9132 433.5077)" class="st1 st4">SS12</text>
<text transform="matrix(1.0301 5.217937e-03 -4.835421e-03 1 294.207 414.3833)" class="st5 st8">Al Rugaib Interiors</text>
</g>
<g id="SS01">
<rect x="13" y="421.9" class="st0" width="31.7" height="38.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 14.0635 457.5413)" class="st1 st4">SS01</text>
<text transform="matrix(1 0 0 1 18.9529 443.0661)" class="st5 st9">Nano</text>
</g>
<g id="SS10">
<rect x="108.2" y="396.5" class="st0" width="76.2" height="38.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 109.3213 432.1395)" class="st1 st4">SS10</text>
<text id="Qatar_Development_Bank" transform="matrix(0.7912 0 0 1 111.3252 414.3945)" class="st5 st10">Qatar Development Bank (QDB)</text>
</g>
<g id="SS03">
<rect x="13" y="396.5" class="st0" width="76.2" height="25.4"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 15.0975 401.8253)" class="st1 st4">SS03</text>
<text transform="matrix(1 0 0 1 31.7155 411.5282)" class="st11 st12">Migalo Home</text>
</g>
<g id="SS04">
<rect x="44.7" y="421.9" class="st0" width="44.5" height="38.1"/>
<text transform="matrix(0.9 -1.050466e-04 1.167184e-04 1 76.5518 457.6346)" class="st1 st4">SS04</text>
<text transform="matrix(1 0 0 1 52.9853 441.2652)" class="st11 st13">Mardesign</text>
</g>
</g>
</svg>
我为此创建了一个类
命名空间Xml2CSharp { [XmlRoot(ElementName =“ style”,Namespace =“ http://www.w3.org/2000/svg”)] 公共课风格 { [XmlAttribute(AttributeName =“ type”)] 公共字符串类型{get;组; } [XmlText] 公共字符串Text {get;组; } }
[XmlRoot(ElementName = "polyline", Namespace = "http://www.w3.org/2000/svg")]
public class Polyline
{
[XmlAttribute(AttributeName = "class")]
public string Class { get; set; }
[XmlAttribute(AttributeName = "points")]
public string Points { get; set; }
}
[XmlRoot(ElementName = "g", Namespace = "http://www.w3.org/2000/svg")]
public class G
{
[XmlElement(ElementName = "polyline", Namespace = "http://www.w3.org/2000/svg")]
public Polyline Polyline { get; set; }
[XmlAttribute(AttributeName = "id")]
public string Id { get; set; }
[XmlElement(ElementName = "rect", Namespace = "http://www.w3.org/2000/svg")]
public Rect Rect { get; set; }
[XmlElement(ElementName = "text", Namespace = "http://www.w3.org/2000/svg")]
public List<Text> Text { get; set; }
[XmlElement(ElementName = "g", Namespace = "http://www.w3.org/2000/svg")]
public List<G> G1 { get; set; }
}
[XmlRoot(ElementName = "rect", Namespace = "http://www.w3.org/2000/svg")]
public class Rect
{
[XmlAttribute(AttributeName = "x")]
public string X { get; set; }
[XmlAttribute(AttributeName = "y")]
public string Y { get; set; }
[XmlAttribute(AttributeName = "class")]
public string Class { get; set; }
[XmlAttribute(AttributeName = "width")]
public string Width { get; set; }
[XmlAttribute(AttributeName = "height")]
public string Height { get; set; }
}
[XmlRoot(ElementName = "text", Namespace = "http://www.w3.org/2000/svg")]
public class Text
{
[XmlAttribute(AttributeName = "transform")]
public string Transform { get; set; }
[XmlAttribute(AttributeName = "class")]
public string Class { get; set; }
[XmlText]
public string Text1 { get; set; }
[XmlAttribute(AttributeName = "id")]
public string Id { get; set; }
}
[XmlRoot(ElementName = "svg", Namespace = "http://www.w3.org/2000/svg")]
public class Svg
{
[XmlElement(ElementName = "style", Namespace = "http://www.w3.org/2000/svg")]
public Style Style { get; set; }
[XmlAttribute(AttributeName = "style")]
public string _Style { get; set; }
[XmlElement(ElementName = "g", Namespace = "http://www.w3.org/2000/svg")]
public G G { get; set; }
[XmlAttribute(AttributeName = "version")]
public string Version { get; set; }
[XmlAttribute(AttributeName = "id")]
public string Id { get; set; }
[XmlAttribute(AttributeName = "xmlns")]
public string Xmlns { get; set; }
[XmlAttribute(AttributeName = "xlink", Namespace = "http://www.w3.org/2000/xmlns/")]
public string Xlink { get; set; }
[XmlAttribute(AttributeName = "x")]
public string X { get; set; }
[XmlAttribute(AttributeName = "y")]
public string Y { get; set; }
[XmlAttribute(AttributeName = "viewBox")]
public string ViewBox { get; set; }
[XmlAttribute(AttributeName = "space", Namespace = "http://www.w3.org/XML/1998/namespace")]
public string Space { get; set; }
}
}
我尝试过的插入代码如下:
课程 { 静态字符串_svgUri = @“ D:\ InsertHallIntoDB \ InsertHallIntoDB \ Files \ NewGroupedmap29oct(1)(1).svg”; 静态字符串_connectionString =“数据源= .;初始目录= FloorPlan;集成安全性=真实”; 静态SqlConnection _connection = null;
static void Main(string[] args)
{
try
{
XmlSerializer serializer = new XmlSerializer(typeof(Svg));
using (TextReader reader = new StreamReader(_svgUri))
{
Svg fileSvg = (Svg)serializer.Deserialize(reader);
// TruncateTable();
//Console.WriteLine(fileSvg);
List<G> recordsToInsert = new List<G>();
using (_connection = new SqlConnection(_connectionString))
{
_connection.Open();
foreach (G fileItem in fileSvg.G.G1)
{
if (fileItem.Rect != null)
{
InsertRect(fileItem);
}
}
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
finally
{
CloseDBConnection();
}
}
static void InsertRect(G fileGroup)
{
string query = "INSERT INTO New_Map(Stand_number,Banner_Name,Shape_Type,Height,Width) Values(@Stand_number, @Banner_Name,@Shape_Type,@Height,@Width)";
using (SqlCommand cmd = new SqlCommand(query, _connection))
{
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@Stand_number", fileGroup.Id ?? (object)DBNull.Value);
//need to insert a banner name here, you can check svg file for it. for example Mardesign
cmd.Parameters.AddWithValue("@Banner_Name", fileGroup.Text.Where(c => !c.Text1.Any(char.IsDigit)) ?? (object)DBNull.Value);
if (fileGroup.Rect != null)
{
cmd.Parameters.AddWithValue("@Shape_Type", "Rectangle");
}
cmd.Parameters.AddWithValue("@Height", fileGroup.Rect.Height ?? (object)DBNull.Value);
cmd.Parameters.AddWithValue("@Width", fileGroup.Rect.Width ?? (object)DBNull.Value);
cmd.ExecuteNonQuery();
}
}
static void CloseDBConnection()
{
if (_connection != null && _connection.State == ConnectionState.Open)
{
_connection.Close();
}
}
}
问题是,我必须插入文本作为横幅名称,但是我无法访问文本元素。请回复。
答案 0 :(得分:1)
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
using Xml2CSharp;
namespace InsertHallIntoDB
{
class Program
{
static string _svgUri = @"D:\InsertHallIntoDB\InsertHallIntoDB\Files\NewGroupedmap29oct(1)(1).svg";
static string _connectionString = "Data Source=.;Initial Catalog=FloorPlan;Integrated Security=True";
static SqlConnection _connection = null;
static void Main(string[] args)
{
try
{
XmlSerializer serializer = new XmlSerializer(typeof(Svg));
using (TextReader reader = new StreamReader(_svgUri))
{
Svg fileSvg = (Svg)serializer.Deserialize(reader);
// TruncateTable();
//Console.WriteLine(fileSvg);
List<G> recordsToInsert = new List<G>();
using (_connection = new SqlConnection(_connectionString))
{
_connection.Open();
foreach (G fileItem in fileSvg.G.G1)
{
if (fileItem.Rect != null)
{
InsertRect(fileItem);
}
}
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
finally
{
CloseDBConnection();
}
}
static void InsertRect(G fileGroup)
{
string query = "INSERT INTO New_Map(Stand_number,Banner_Name,Shape_Type,Height,Width) Values(@Stand_number, @Banner_Name,@Shape_Type,@Height,@Width)";
using (SqlCommand cmd = new SqlCommand(query, _connection))
{
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@Stand_number", fileGroup.Id ?? (object)DBNull.Value);
//need to insert a banner name here, you can check svg file for it. for example Mardesign
var value = fileGroup.Text.Find(c => !c.Text1.Any(char.IsDigit));
if (value != null)
{
cmd.Parameters.AddWithValue("@Banner_Name", value.Text1 ?? (object)DBNull.Value);
}
else
{
cmd.Parameters.AddWithValue("@Banner_Name", "Null");
}
if (fileGroup.Rect != null)
{
cmd.Parameters.AddWithValue("@Shape_Type", "Rectangle");
}
cmd.Parameters.AddWithValue("@Height", fileGroup.Rect.Height ?? (object)DBNull.Value);
cmd.Parameters.AddWithValue("@Width", fileGroup.Rect.Width ?? (object)DBNull.Value);
cmd.ExecuteNonQuery();
}
}
static void CloseDBConnection()
{
if (_connection != null && _connection.State == ConnectionState.Open)
{
_connection.Close();
}
}
static void TruncateTable()
{
try
{
using (_connection = new SqlConnection(_connectionString))
{
// Open your connection
_connection.Open();
//Change the table name here
string sql = "truncate table New_Map";
// Create the Command and Parameter objects.
SqlCommand cmd = new SqlCommand(sql, _connection);
cmd.ExecuteNonQuery();
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
finally
{
CloseDBConnection();
}
}
}
}
enter code here