<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>connector-net &#8211; MaxVergelli.com</title>
	<atom:link href="https://www.maxvergelli.com/tag/connector-net/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.maxvergelli.com</link>
	<description>sourcecode repository</description>
	<lastBuildDate>Wed, 01 Jun 2016 14:28:05 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://i2.wp.com/www.maxvergelli.com/wp-content/uploads/2020/04/wp-1586823685141.png?fit=32%2C32&#038;ssl=1</url>
	<title>connector-net &#8211; MaxVergelli.com</title>
	<link>https://www.maxvergelli.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">34603511</site>	<item>
		<title>MySqlHelper VB.NET class &#8211; easly execute commands against a MySQL database</title>
		<link>https://www.maxvergelli.com/mysqlhelper-vb-net-class-execute-commands-against-a-mysql-database/</link>
					<comments>https://www.maxvergelli.com/mysqlhelper-vb-net-class-execute-commands-against-a-mysql-database/#respond</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Wed, 01 Jun 2016 14:28:05 +0000</pubDate>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[VB.Net]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[connection-string]]></category>
		<category><![CDATA[connector-net]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[data-adapter]]></category>
		<category><![CDATA[data-layer]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database-connector]]></category>
		<category><![CDATA[dataset]]></category>
		<category><![CDATA[datetime-conversion]]></category>
		<category><![CDATA[db]]></category>
		<category><![CDATA[execute-scalar]]></category>
		<category><![CDATA[execute-sql-programmatically]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[helper-class]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql-client]]></category>
		<category><![CDATA[mysql-command]]></category>
		<category><![CDATA[mysql-database-connector]]></category>
		<category><![CDATA[mysql-datetime]]></category>
		<category><![CDATA[mysql-datetime-conversion]]></category>
		<category><![CDATA[mysql-parameter]]></category>
		<category><![CDATA[record]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[sql-command]]></category>
		<category><![CDATA[sql-reader]]></category>
		<category><![CDATA[stored-procedure]]></category>
		<category><![CDATA[vb.net]]></category>
		<category><![CDATA[wrapper-class]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=45</guid>

					<description><![CDATA[Hi all, with the following free .net helper class you can easly execute SQL commands against a MySQL database, execute stored procedures, get or programmatically update tables/DataSet objects and convert to and from MySQL datetime types. Enjoy! 🙂 [sourcecode language=&#8221;vb&#8221;] &#8230; <a class="kt-excerpt-readmore" href="https://www.maxvergelli.com/mysqlhelper-vb-net-class-execute-commands-against-a-mysql-database/" aria-label="MySqlHelper VB.NET class &#8211; easly execute commands against a MySQL database">Read More</a>]]></description>
										<content:encoded><![CDATA[<p>Hi all, with the following free .net helper class you can easly execute SQL commands against a MySQL database, execute stored procedures, get or programmatically update tables/DataSet objects and convert to and from MySQL datetime types.</p>
<p>Enjoy! 🙂</p>
[sourcecode language=&#8221;vb&#8221;]
<p>&#8216;	MySqlHelper VB.NET class<br />
&#8216;	http://www.maxvergelli.com/</p>
<p>&#8216;	Copyright (c) 2016 Max Vergelli</p>
<p>&#8216;   Vers. 2.1.0<br />
&#8216;   Date: 21/03/2016</p>
<p>&#8216;   Description:<br />
&#8216;   .NET helper class to easly execute SQL commands against a MySQL database,<br />
&#8216;   execute stored procedures, get or programmatically update DataSet objects,<br />
&#8216;   and convert to and from MySQL datetime types.<br />
&#8216;<br />
&#8216;   Before use this class, You have to install and import in your project the<br />
&#8216;   last MySQL Connector/NET at<br />
&#8216;   http://dev.mysql.com/doc/refman/5.0/es/connector-net.html</p>
<p>&#8216;	Permission is hereby granted, free of charge, to any person obtaining a copy<br />
&#8216;	of this software and associated documentation files (the &quot;Software&quot;), to deal<br />
&#8216;	in the Software without restriction, including without limitation the rights<br />
&#8216;	to use, copy, modify, merge, publish, distribute, sublicense, and/or sell<br />
&#8216;	copies of the Software, and to permit persons to whom the Software is<br />
&#8216;	furnished to do so, subject to the following conditions:</p>
<p>&#8216;	The above copyright notice and this permission notice shall be included in<br />
&#8216;	all copies or substantial portions of the Software.</p>
<p>&#8216;	THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br />
&#8216;	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br />
&#8216;	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE<br />
&#8216;	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br />
&#8216;	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,<br />
&#8216;	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN<br />
&#8216;	THE SOFTWARE.</p>
<p>Imports System.Data<br />
Imports System.Globalization<br />
Imports MySql.Data.MySqlClient</p>
<p>Public Class MySqlHelper</p>
<p>    Private _cnx_string As String = Nothing<br />
    Private _cnx_obj As MySqlConnection = Nothing</p>
<p>    Private Function IsConnectionAlive() As Boolean<br />
        Dim is_alive As Boolean = False<br />
        If _cnx_obj IsNot Nothing AndAlso _cnx_obj.State &lt;&gt; ConnectionState.Closed Then<br />
            is_alive = True<br />
        End If<br />
        Return is_alive<br />
    End Function</p>
<p>    Private Sub CloseConnection()</p>
<p>        Try</p>
<p>            If IsConnectionAlive() Then<br />
                _cnx_obj.Close()<br />
            End If<br />
            _cnx_obj = Nothing</p>
<p>        Catch ex As Exception</p>
<p>            _cnx_obj = Nothing</p>
<p>        End Try</p>
<p>    End Sub</p>
<p>    Public ReadOnly Property ConnectionString() As String<br />
        Get<br />
            Return _cnx_string<br />
        End Get<br />
    End Property</p>
<p>    Public Function IsOpen() As Boolean<br />
        Return IsConnectionAlive()<br />
    End Function</p>
<p>    Public Sub New(Optional ByVal db_connection_string As String = &quot;&quot;, _<br />
                   Optional ByVal open_connection As Boolean = False)</p>
<p>        _cnx_string = db_connection_string</p>
<p>        If _cnx_string.Length &gt; 0 And open_connection = True Then</p>
<p>            Dim is_open As Boolean = Open(_cnx_string)</p>
<p>        End If</p>
<p>    End Sub</p>
<p>    Public Function Open(ByVal db_connection_string As String) As Boolean</p>
<p>        Dim success As Boolean = False<br />
        Try</p>
<p>            If IsConnectionAlive() = False Then</p>
<p>                If db_connection_string.Length &gt; 0 AndAlso _cnx_obj Is Nothing Then</p>
<p>                    _cnx_string = db_connection_string<br />
                    _cnx_obj = New MySqlConnection<br />
                    _cnx_obj.ConnectionString = _cnx_string<br />
                    _cnx_obj.Open()<br />
                    success = True</p>
<p>                End If</p>
<p>            End If</p>
<p>        Catch ex As Exception</p>
<p>            CloseConnection()<br />
            success = False</p>
<p>        End Try<br />
        Return success</p>
<p>    End Function</p>
<p>    Public Sub Close()</p>
<p>        CloseConnection()</p>
<p>    End Sub</p>
<p>    Protected Overrides Sub Finalize()<br />
        CloseConnection()<br />
    End Sub</p>
<p>    &#8216;get a DataRow object with the first row of a SQL select command<br />
    Public Function SelectFirstRow(ByVal sql_select As String) As DataRow</p>
<p>        Dim ds As DataSet = SelectRows(sql_select)<br />
        If ds Is Nothing Then<br />
            Return Nothing<br />
        End If<br />
        If ds.Tables.Count &lt; 1 Then<br />
            Return Nothing<br />
        End If<br />
        If ds.Tables(0).Rows.Count &lt; 1 Then<br />
            Return Nothing<br />
        End If<br />
        Return ds.Tables(0).Rows(0)</p>
<p>    End Function</p>
<p>    &#8216;get a DataSet object with the rows of a SQL select command<br />
    Public Function SelectRows(ByVal sql_select As String) As DataSet</p>
<p>        Dim ds As DataSet = Nothing<br />
        Try</p>
<p>            If IsConnectionAlive() Then</p>
<p>                Dim cmd As MySqlCommand = New MySqlCommand(sql_select, _cnx_obj)</p>
<p>                Dim da As MySqlDataAdapter = New MySqlDataAdapter<br />
                da.SelectCommand = cmd</p>
<p>                ds = New DataSet<br />
                da.Fill(ds)</p>
<p>                da = Nothing</p>
<p>            End If</p>
<p>        Catch ex As Exception</p>
<p>            ds = Nothing</p>
<p>        End Try<br />
        Return ds</p>
<p>    End Function</p>
<p>    &#8216;Execute a MySql Stored Procedure<br />
    Public Overloads Function ExecuteStoredProcedure(ByVal stored_procedure_name As String) As DataSet</p>
<p>        Return ExecuteProcedure(stored_procedure_name)</p>
<p>    End Function</p>
<p>    &#8216;Execute a MySql Stored Procedure with parameters</p>
<p>    &#8216;How to create the parameters<br />
    &#8216;Dim param As MySqlParameter = New MySqlParameter(&quot;?v_id&quot;, MySqlDbType.Int32)<br />
    &#8216;param.Value = 1<br />
    &#8216;param.Direction = ParameterDirection.Input</p>
<p>    Public Overloads Function ExecuteStoredProcedure(ByVal stored_procedure_name As String, _<br />
                                                     ByVal ParamArray parameters As MySqlParameter()) As DataSet</p>
<p>        Return ExecuteProcedure(stored_procedure_name, parameters)</p>
<p>    End Function</p>
<p>    Private Function ExecuteProcedure(ByVal procedure_name As String, _<br />
                                            ByVal ParamArray sql_parameters As MySqlParameter()) As DataSet</p>
<p>        Dim ds As DataSet = Nothing<br />
        Try<br />
            If IsConnectionAlive() Then</p>
<p>                Dim cmd As New MySqlCommand(procedure_name, _cnx_obj)</p>
<p>                cmd.CommandType = CommandType.StoredProcedure</p>
<p>                If sql_parameters IsNot Nothing Then<br />
                    For Each p As MySqlParameter In sql_parameters<br />
                        cmd.Parameters.Add(p)<br />
                    Next<br />
                End If</p>
<p>                Dim da As MySqlDataAdapter = New MySqlDataAdapter<br />
                da.SelectCommand = cmd<br />
                ds = New DataSet<br />
                da.Fill(ds)<br />
                da = Nothing</p>
<p>                cmd.Parameters.Clear()</p>
<p>            End If<br />
        Catch ex As Exception</p>
<p>            ds = Nothing</p>
<p>        End Try</p>
<p>        Return ds</p>
<p>    End Function</p>
<p>    &#8216;UpdateRows() function automatically generates single-table commands used to reconcile changes made to a DataSet<br />
    &#8216;with the associated table in the MySQL database.<br />
    &#8216;The function gets<br />
    &#8216; &#8211; the SQL SELECT used to populate the dataset<br />
    &#8216; &#8211; the updated dataset<br />
    &#8216; &#8211; the table name that must be updated in the database<br />
    &#8216;Note:<br />
    &#8216;The SQL SELECT must also return at least one primary key or unique column, otherwise an exception is generated;</p>
<p>    Public Function UpdateRows(ByVal sql_select As String, ByRef input_dataset As DataSet, ByVal table_name As String) As Boolean</p>
<p>        Dim success As Boolean = False<br />
        Try</p>
<p>            If IsConnectionAlive() Then</p>
<p>                Dim data_adapter As New MySqlDataAdapter(sql_select, _cnx_obj)<br />
                Dim cmd_builder As New MySqlCommandBuilder(data_adapter)<br />
                data_adapter.Update(input_dataset, table_name)<br />
                success = True</p>
<p>            End If</p>
<p>        Catch ex As Exception</p>
<p>            success = False</p>
<p>        End Try</p>
<p>        Return success</p>
<p>    End Function</p>
<p>    &#8216;To use a MySqlDataReader,<br />
    &#8216;You have to use OpenReader() and CloseReader() functions like in the following example:<br />
    &#8216;<br />
    &#8216;    Public Sub ReadMyData(ByVal connection_string As String)<br />
    &#8216;<br />
    &#8216;        Dim mysql As MySqlHelper = New MySqlHelper()<br />
    &#8216;        mysql.Open(connection_string)<br />
    &#8216;<br />
    &#8216;        Dim sql As String = &quot;SELECT OrderID, CustomerID FROM Orders&quot;<br />
    &#8216;        Dim reader As MySqlDataReader = Nothing<br />
    &#8216;<br />
    &#8216;        mysql.OpenReader(reader, sql)<br />
    &#8216;        While reader.Read()<br />
    &#8216;            Console.WriteLine((reader.GetInt32(0) &amp; &quot;, &quot; &amp; reader.GetString(1)))<br />
    &#8216;        End While<br />
    &#8216;        mysql.CloseReader(reader)<br />
    &#8216;<br />
    &#8216;        mysql.Close()<br />
    &#8216;<br />
    &#8216;    End Sub</p>
<p>    Public Sub OpenReader(ByRef reader As MySqlDataReader, ByVal sql_select As String)</p>
<p>        Try<br />
            If IsConnectionAlive() Then</p>
<p>                Dim cmd As New MySqlCommand(sql_select, _cnx_obj)<br />
                reader = cmd.ExecuteReader()</p>
<p>            End If</p>
<p>        Catch ex As Exception</p>
<p>            reader = Nothing</p>
<p>        End Try</p>
<p>    End Sub</p>
<p>    Public Sub CloseReader(ByRef reader As MySqlDataReader)</p>
<p>        Try</p>
<p>            reader.Close()</p>
<p>        Catch ex As Exception</p>
<p>        End Try</p>
<p>    End Sub</p>
<p>    &#8216;Execute SQL command and return the number of records affected<br />
    Public Function Execute(ByVal sql_command As String) As Long</p>
<p>        Dim affected_rows As Long = 0</p>
<p>        Try<br />
            If IsConnectionAlive() Then</p>
<p>                Dim cmd As New MySqlCommand(sql_command, _cnx_obj)</p>
<p>                affected_rows = cmd.ExecuteNonQuery()</p>
<p>            End If</p>
<p>        Catch ex As Exception</p>
<p>            affected_rows = 0</p>
<p>        End Try</p>
<p>        Return affected_rows</p>
<p>    End Function</p>
<p>    &#8216;GetSingleValue() function executes the query, and returns the value of the first column of the first row in the<br />
    &#8216;result set returned by the query. Extra columns or rows are ignored.<br />
    &#8216;Note:<br />
    &#8216;Use the GetSingleValue() method to retrieve a single value (for example, an aggregate value)<br />
    &#8216;from a database, like &quot;select count(*) from region&quot;</p>
<p>    Public Overloads Function GetSingleValue(ByVal sql_select As String) As Object</p>
<p>        Return ExecuteScalar(sql_select, DirectCast(Nothing, MySqlParameter()))</p>
<p>    End Function</p>
<p>    Public Overloads Function GetSingleValue(ByVal sql_select As String, ByVal ParamArray sql_parameters As MySqlParameter()) As Object</p>
<p>        Return ExecuteScalar(sql_select, sql_parameters)</p>
<p>    End Function</p>
<p>    &#8216;ExecuteScalar: Executes the query, and returns the value (integer/string) of the first column of the first row in the result set returned by the query. Extra columns or rows are ignored.<br />
    Private Function ExecuteScalar(ByVal sql_select As String, ByVal ParamArray sql_parameters As MySqlParameter()) As Object</p>
<p>        Dim row As Object = Nothing<br />
        Try<br />
            If IsConnectionAlive() Then</p>
<p>                Dim cmd As New MySqlCommand(sql_select, _cnx_obj)<br />
                If sql_parameters IsNot Nothing Then<br />
                    For Each p As MySqlParameter In sql_parameters<br />
                        cmd.Parameters.Add(p)<br />
                    Next<br />
                End If<br />
                row = cmd.ExecuteScalar()<br />
                cmd.Parameters.Clear()</p>
<p>            End If<br />
        Catch ex As Exception</p>
<p>            row = Nothing</p>
<p>        End Try</p>
<p>        Return row</p>
<p>    End Function</p>
<p>    &#8217;25/1/12 -&gt; 2012-01-25<br />
    Public Overloads Function ConvertToMySqlDate(ByVal input_date As Date) As String</p>
<p>        Return input_date.ToString(&quot;yyyy-MM-dd&quot;)</p>
<p>    End Function</p>
<p>    &#8217;25/1/12 -&gt; 2012-01-25<br />
    Public Overloads Function ConvertToMySqlDate(ByVal input_date As String) As String</p>
<p>        Return ConvertDateTime(input_date, DATETIME_TYPE.MYSQL, True)</p>
<p>    End Function</p>
<p>    &#8217;25/1/12 13:00 -&gt; 2012-01-25 13:00:00<br />
    Public Overloads Function ConvertToMySqlDateTime(ByVal input_datetime As DateTime) As String</p>
<p>        Return input_datetime.ToString(&quot;yyyy-MM-dd HH:mm:ss&quot;)</p>
<p>    End Function</p>
<p>    &#8217;25/1/12 13:00 -&gt; 2012-01-25 13:00:00<br />
    Public Overloads Function ConvertToMySqlDateTime(ByVal input_datetime As String) As String</p>
<p>        Return ConvertDateTime(input_datetime, DATETIME_TYPE.MYSQL)</p>
<p>    End Function</p>
<p>    &#8216;2012-01-25 -&gt; 25-01-2012<br />
    Public Overloads Function ConvertToDate(ByVal mysql_date As Date) As String</p>
<p>        Return mysql_date.ToString(&quot;dd-MM-yyyy&quot;)</p>
<p>    End Function</p>
<p>    &#8216;2012-01-25 -&gt; 25-01-2012<br />
    Public Overloads Function ConvertToDate(ByVal mysql_date As String) As String</p>
<p>        Return ConvertDateTime(mysql_date, DATETIME_TYPE.SYSTEM, True)</p>
<p>    End Function</p>
<p>    &#8216;2012-01-25 13:00:00 -&gt; 25-01-2012 13:00:00<br />
    Public Overloads Function ConvertToDateTime(ByVal mysql_datetime As DateTime) As String</p>
<p>        Return mysql_datetime.ToString(&quot;dd-MM-yyyy HH:mm:ss&quot;)</p>
<p>    End Function</p>
<p>    &#8216;2012-01-25 13:00:00 -&gt; 25-01-2012 13:00:00<br />
    Public Overloads Function ConvertToDateTime(ByVal mysql_datetime As String) As String</p>
<p>        Return ConvertDateTime(mysql_datetime, DATETIME_TYPE.SYSTEM)</p>
<p>    End Function</p>
<p>    Private Enum DATETIME_TYPE As Integer<br />
        SYSTEM = 0<br />
        MYSQL = 1<br />
    End Enum</p>
<p>    Private Function ConvertDateTime(ByVal input_datetime As String, ByVal output_datetime_type As DATETIME_TYPE, _<br />
                                                                    Optional ByVal get_only_date As Boolean = False) As String</p>
<p>        &#8216;The function returns a datetime in a well-formatted string for regular or MySQL use.<br />
        &#8216;You have to insert a datetime string formatted by {,/,-,.,:} symbols.<br />
        &#8216;Besides, for the input date, You need to specify &quot;day, month and year&quot;;<br />
        &#8216;for the time, only &quot;hour and minutes&quot;, &quot;seconds&quot; doesn&#8217;t matter.</p>
<p>        &#8216;The function returns Nothing if an error is encountered.</p>
<p>        &#8216;You can select one of the following datetime types as output:<br />
        &#8216;SYSTEM: &quot;(2 digits day)-(2 digits month)-(4 digits year) hours:minutes:seconds&quot;<br />
        &#8216;MYSQL: &quot;(4 digits year)-(2 digits month)-(2 digits day) hours:minutes:seconds&quot;</p>
<p>        &#8216;examples:<br />
        &#8216;for a regular datetime in input and<br />
        &#8216;a MySql datetime as output, You &#8216;ll get&#8230;</p>
<p>        &#8217;25-1-08 -&gt; 2008-01-25 00:00:00<br />
        &#8217;25/1/08 -&gt; 2008-01-25 00:00:00<br />
        &#8217;25/1/08 12:00 -&gt; 2008-01-25 12:00:00<br />
        &#8217;25-1-08 12:00 -&gt; 2008-01-25 12:00:00<br />
        &#8216;25.1.08 12:00 -&gt; 2008-01-25 12:00:00<br />
        &#8216;25.1.08 12.00 -&gt; 2008-01-25 12:00:00<br />
        &#8216;25.1.08 12.00.23 -&gt; 2008-01-25 12:00:23</p>
<p>        Dim dt_out As String = Nothing<br />
        Dim dt_type As String = &quot;&quot;<br />
        If output_datetime_type = DATETIME_TYPE.MYSQL Then<br />
            dt_type = &quot;yyyy-MM-dd HH&#8217;:&#8217;mm&#8217;:&#8217;ss&quot;<br />
        Else<br />
            dt_type = &quot;dd-MM-yyyy HH&#8217;:&#8217;mm&#8217;:&#8217;ss&quot;<br />
        End If<br />
        Try<br />
            If input_datetime.IndexOf(&quot;.&quot;, 0, CompareMethod.Binary) &gt; 0 Then<br />
                Dim tmp() As String = input_datetime.Split(&quot; &quot;)<br />
                If tmp.GetUpperBound(0) &gt; 0 Then<br />
                    input_datetime = tmp(0).Replace(&quot;.&quot;, &quot;-&quot;) &amp; &quot; &quot; &amp; tmp(1).Replace(&quot;.&quot;, &quot;:&quot;)<br />
                End If<br />
            End If<br />
            Dim myDTFI As DateTimeFormatInfo = New CultureInfo(&quot;it-IT&quot;, False).DateTimeFormat<br />
            myDTFI.FullDateTimePattern = &quot;dd-MM-yyyy HH&#8217;:&#8217;mm&#8217;:&#8217;ss&quot;<br />
            myDTFI.DateSeparator = &quot;-&quot;<br />
            myDTFI.TimeSeparator = &quot;:&quot;<br />
            Dim myDT As New DateTime<br />
            myDT = System.Convert.ToDateTime(input_datetime, myDTFI)<br />
            dt_out = Format(myDT, dt_type)<br />
            myDT = Nothing<br />
            myDTFI = Nothing<br />
            If get_only_date = True Then<br />
                Dim s() As String = dt_out.Split(&quot; &quot;)<br />
                If s.GetUpperBound(0) &gt; 0 Then<br />
                    dt_out = s(0)<br />
                End If<br />
            End If<br />
        Catch ex As Exception<br />
            dt_out = Nothing<br />
        End Try<br />
        Return dt_out</p>
<p>    End Function</p>
<p>End Class</p>
[/sourcecode]
]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/mysqlhelper-vb-net-class-execute-commands-against-a-mysql-database/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">45</post-id>	</item>
	</channel>
</rss>
