<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: The VB.NET-MySQL Tutorial &#8211; Part 6</title>
	<atom:link href="http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-6/feed" rel="self" type="application/rss+xml" />
	<link>http://www.vbmysql.com</link>
	<description>The Site for VB and MySQL</description>
	<lastBuildDate>Fri, 12 Mar 2010 01:05:36 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.3</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Charlie Childs</title>
		<link>http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-6/comment-page-1#comment-38674</link>
		<dc:creator>Charlie Childs</dc:creator>
		<pubDate>Tue, 03 Nov 2009 23:07:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-6/#comment-38674</guid>
		<description>I had a crash problem with a duplicate parameter.  Because it is coded twice in the final cmdUpdate VB 2008 Express shows error and stops program running just  after a personally specified status message was added and I hit the update button .  The offending line was pointed out by VB express crash mode ( error message &quot;Parameter &#039;?UserID&#039; has already been defined.&quot;).   After a little trial and error I tried removing the &quot;?&quot; from the &quot;?UserID&quot; bit and all works perfectly -  apart from the same problem I have had since part 4 of this tutorial - that is that my insert event query is not producing a new row -- my rows are being over written with updated status (all explained in my entry at the end of part 4 if anyone can help) - any help with that would be grately appreciated.

This is the duplicate line of code which caused the form to refuse personally specified messages being updated:

Extract from &quot;the completed cmdUpdate_Click procedure&quot; at end of tutorial 4.


&lt;!--   HERE --&gt;&gt;&gt;    myCommand.Parameters.Add(&quot;?userID&quot;, myUserID)                   
                             myCommand.Parameters.Add(&quot;?message&quot;, cboMessage.Text)

                        Try
                                conn.Open()
                                myMessage = New clsMessage(myCommand.ExecuteScalar(), cboMessage.Text)
                                cboMessage.Items.Insert(1, myMessage)
                               cboMessage.SelectedIndex = 1
                                conn.Close()
                        Catch myerror As MySqlException
                                MsgBox(&quot;There was an error updating the database: &quot; &amp; myerror.Message)
                        End Try
                End If

                myCommand.CommandText = &quot;INSERT INTO event(user_id, message_id, timestamp, status, creator)&quot; _
                 &amp; &quot;VALUES(?UserID, ?MessageID, NOW(), ?Status, ?Creator)&quot;

  &lt;!--  AND HERE --&gt;&gt;&gt;   myCommand.Parameters.Add(&quot;?UserID&quot;, myUserID)

The only difference between the above and my code is the &quot;Add&quot; becomes &quot;AddWithValue&quot; in VB 2008 Express

If anone can see how removing the &quot;?&quot; from &quot;?UserID&quot; may cause serious problems to the program down the line please let me and others who read this know. Thanks</description>
		<content:encoded><![CDATA[<p>I had a crash problem with a duplicate parameter.  Because it is coded twice in the final cmdUpdate VB 2008 Express shows error and stops program running just  after a personally specified status message was added and I hit the update button .  The offending line was pointed out by VB express crash mode ( error message &#8220;Parameter &#8216;?UserID&#8217; has already been defined.&#8221;).   After a little trial and error I tried removing the &#8220;?&#8221; from the &#8220;?UserID&#8221; bit and all works perfectly &#8211;  apart from the same problem I have had since part 4 of this tutorial &#8211; that is that my insert event query is not producing a new row &#8212; my rows are being over written with updated status (all explained in my entry at the end of part 4 if anyone can help) &#8211; any help with that would be grately appreciated.</p>
<p>This is the duplicate line of code which caused the form to refuse personally specified messages being updated:</p>
<p>Extract from &#8220;the completed cmdUpdate_Click procedure&#8221; at end of tutorial 4.</p>
<p><!--   HERE -->&gt;&gt;    myCommand.Parameters.Add(&#8221;?userID&#8221;, myUserID)<br />
                             myCommand.Parameters.Add(&#8221;?message&#8221;, cboMessage.Text)</p>
<p>                        Try<br />
                                conn.Open()<br />
                                myMessage = New clsMessage(myCommand.ExecuteScalar(), cboMessage.Text)<br />
                                cboMessage.Items.Insert(1, myMessage)<br />
                               cboMessage.SelectedIndex = 1<br />
                                conn.Close()<br />
                        Catch myerror As MySqlException<br />
                                MsgBox(&#8221;There was an error updating the database: &#8221; &amp; myerror.Message)<br />
                        End Try<br />
                End If</p>
<p>                myCommand.CommandText = &#8220;INSERT INTO event(user_id, message_id, timestamp, status, creator)&#8221; _<br />
                 &amp; &#8220;VALUES(?UserID, ?MessageID, NOW(), ?Status, ?Creator)&#8221;</p>
<p>  <!--  AND HERE -->&gt;&gt;   myCommand.Parameters.Add(&#8221;?UserID&#8221;, myUserID)</p>
<p>The only difference between the above and my code is the &#8220;Add&#8221; becomes &#8220;AddWithValue&#8221; in VB 2008 Express</p>
<p>If anone can see how removing the &#8220;?&#8221; from &#8220;?UserID&#8221; may cause serious problems to the program down the line please let me and others who read this know. Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Felix</title>
		<link>http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-6/comment-page-1#comment-38283</link>
		<dc:creator>Felix</dc:creator>
		<pubDate>Mon, 02 Nov 2009 08:56:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-6/#comment-38283</guid>
		<description>kann mir mal einer helfen bei meinem problem ich komme mit derm tutorial nicht so ganz klar.


und zwar habe ich folgendes problem: ich habe eine MySQL datenbank und möchte über VB.Net darauf zugreifen und bearbeiten aber es geht nicht ich bekomme keine verbindung zur datenbank. woran kann es liegen?</description>
		<content:encoded><![CDATA[<p>kann mir mal einer helfen bei meinem problem ich komme mit derm tutorial nicht so ganz klar.</p>
<p>und zwar habe ich folgendes problem: ich habe eine MySQL datenbank und möchte über VB.Net darauf zugreifen und bearbeiten aber es geht nicht ich bekomme keine verbindung zur datenbank. woran kann es liegen?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Website links : Saidul Islam &#171; ACM &#38; Project Euler :: Solved Problems</title>
		<link>http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-6/comment-page-1#comment-27841</link>
		<dc:creator>Website links : Saidul Islam &#171; ACM &#38; Project Euler :: Solved Problems</dc:creator>
		<pubDate>Tue, 02 Jun 2009 17:52:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-6/#comment-27841</guid>
		<description>[...] http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-6 [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-6" rel="nofollow">http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-6</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: c1y1k</title>
		<link>http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-6/comment-page-1#comment-27464</link>
		<dc:creator>c1y1k</dc:creator>
		<pubDate>Mon, 25 May 2009 04:57:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-6/#comment-27464</guid>
		<description>coba script ini:

   
 Public Function GetConnect()
        Dim conn As New MySqlConnection

        conn = New MySqlConnection(&quot;server=localhost;user id=root;password=ariek;database=kartu_puas&quot;)

        Return conn

    End Function

    Private conn As New MySqlConnection(&quot;server=localhost;user id=root;password=ariek;database=kartu_puas&quot;)

    Public MySqlComm As New MySql.Data.MySqlClient.MySqlCommand
    Public Sub PerintahSQL(ByVal S As String)

        MySqlComm = New MySql.Data.MySqlClient.MySqlCommand(S, conn)
        MySqlComm.CommandType = CommandType.Text
        MySqlComm.ExecuteNonQuery()
    End Sub

    Private Sub cbfakultas_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbfakultas.SelectedIndexChanged


        Dim s As String = &quot;SELECT * FROM jurusan where fakultas=&#039;&quot; &amp; Me.cbfakultas.Text &amp; &quot;&#039;&quot;
        If conn.State = ConnectionState.Closed Then
            conn = GetConnect()
            conn.Open()
        Else
            conn = GetConnect()
            conn.Close()
            conn.Open()
        End If

        PerintahSQL(s)
        Dim bb As MySql.Data.MySqlClient.MySqlDataReader = MySqlComm.ExecuteReader(CommandBehavior.CloseConnection)
        Me.cbjurusan.Items.Clear()
        Me.cbjurusan.Text = &quot;&quot;
        Do While bb.Read

            Me.cbjurusan.Items.Add(bb(&quot;jurusan&quot;))

        Loop
        conn = GetConnect()
        conn.Close()
    End Sub</description>
		<content:encoded><![CDATA[<p>coba script ini:</p>
<p> Public Function GetConnect()<br />
        Dim conn As New MySqlConnection</p>
<p>        conn = New MySqlConnection(&#8221;server=localhost;user id=root;password=ariek;database=kartu_puas&#8221;)</p>
<p>        Return conn</p>
<p>    End Function</p>
<p>    Private conn As New MySqlConnection(&#8221;server=localhost;user id=root;password=ariek;database=kartu_puas&#8221;)</p>
<p>    Public MySqlComm As New MySql.Data.MySqlClient.MySqlCommand<br />
    Public Sub PerintahSQL(ByVal S As String)</p>
<p>        MySqlComm = New MySql.Data.MySqlClient.MySqlCommand(S, conn)<br />
        MySqlComm.CommandType = CommandType.Text<br />
        MySqlComm.ExecuteNonQuery()<br />
    End Sub</p>
<p>    Private Sub cbfakultas_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbfakultas.SelectedIndexChanged</p>
<p>        Dim s As String = &#8220;SELECT * FROM jurusan where fakultas=&#8217;&#8221; &amp; Me.cbfakultas.Text &amp; &#8220;&#8216;&#8221;<br />
        If conn.State = ConnectionState.Closed Then<br />
            conn = GetConnect()<br />
            conn.Open()<br />
        Else<br />
            conn = GetConnect()<br />
            conn.Close()<br />
            conn.Open()<br />
        End If</p>
<p>        PerintahSQL(s)<br />
        Dim bb As MySql.Data.MySqlClient.MySqlDataReader = MySqlComm.ExecuteReader(CommandBehavior.CloseConnection)<br />
        Me.cbjurusan.Items.Clear()<br />
        Me.cbjurusan.Text = &#8220;&#8221;<br />
        Do While bb.Read</p>
<p>            Me.cbjurusan.Items.Add(bb(&#8221;jurusan&#8221;))</p>
<p>        Loop<br />
        conn = GetConnect()<br />
        conn.Close()<br />
    End Sub</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: andre</title>
		<link>http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-6/comment-page-1#comment-25325</link>
		<dc:creator>andre</dc:creator>
		<pubDate>Tue, 07 Apr 2009 10:43:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-6/#comment-25325</guid>
		<description>nevermind.... i still don&#039;t know why  i got the error but i downloaded the tutorial source and modified that and it works</description>
		<content:encoded><![CDATA[<p>nevermind&#8230;. i still don&#8217;t know why  i got the error but i downloaded the tutorial source and modified that and it works</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: andre</title>
		<link>http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-6/comment-page-1#comment-25323</link>
		<dc:creator>andre</dc:creator>
		<pubDate>Tue, 07 Apr 2009 10:23:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-6/#comment-25323</guid>
		<description>getting the same error as darin above when trying to select db fields... any ideas?

its basically ‘key cannot be null. Parameter name : key’. 
thats the error and all the syntax is exactly the same as the tutorial except i changed the query which works when typed into sql browser</description>
		<content:encoded><![CDATA[<p>getting the same error as darin above when trying to select db fields&#8230; any ideas?</p>
<p>its basically ‘key cannot be null. Parameter name : key’.<br />
thats the error and all the syntax is exactly the same as the tutorial except i changed the query which works when typed into sql browser</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rachel Taylor</title>
		<link>http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-6/comment-page-1#comment-22867</link>
		<dc:creator>Rachel Taylor</dc:creator>
		<pubDate>Sat, 10 Jan 2009 21:13:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-6/#comment-22867</guid>
		<description>hi
30na1gb5crvydsvv
good luck</description>
		<content:encoded><![CDATA[<p>hi<br />
30na1gb5crvydsvv<br />
good luck</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marlin Ward</title>
		<link>http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-6/comment-page-1#comment-22859</link>
		<dc:creator>Marlin Ward</dc:creator>
		<pubDate>Fri, 09 Jan 2009 07:47:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-6/#comment-22859</guid>
		<description>hi
30na1gb5crvydsvv
good luck</description>
		<content:encoded><![CDATA[<p>hi<br />
30na1gb5crvydsvv<br />
good luck</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fernando</title>
		<link>http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-6/comment-page-1#comment-22402</link>
		<dc:creator>Fernando</dc:creator>
		<pubDate>Mon, 01 Dec 2008 09:00:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-6/#comment-22402</guid>
		<description>to Anthony:

I have the same problem with .Focus() method and solve it changing to .Select() method.</description>
		<content:encoded><![CDATA[<p>to Anthony:</p>
<p>I have the same problem with .Focus() method and solve it changing to .Select() method.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anthony</title>
		<link>http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-6/comment-page-1#comment-21538</link>
		<dc:creator>Anthony</dc:creator>
		<pubDate>Thu, 06 Nov 2008 06:06:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.vbmysql.com/articles/vbnet-mysql-tutorials/the-vbnet-mysql-tutorial-part-6/#comment-21538</guid>
		<description>I&#039;m coding this tutorial with Visual Studio 2005 and everything is working properly.  The problem that I&#039;m having is with changing the focus to the txtPassword field if the My.Settings.Username  &quot;&quot;.  It isn&#039;t working.  

I had actually tried doing this in the previous tutorial because I was getting annoyed at having to tab all the time.  When I realized it wasn&#039;t working with the Form_Load event and the .Focus(), I tried by changing the tab Index to 0 (again, in the form_load event).  That worked.  When i tried the method here by putting it in the frmLogin_Activated section, it doesn&#039;t work.  

Any suggestions?</description>
		<content:encoded><![CDATA[<p>I&#8217;m coding this tutorial with Visual Studio 2005 and everything is working properly.  The problem that I&#8217;m having is with changing the focus to the txtPassword field if the My.Settings.Username  &#8220;&#8221;.  It isn&#8217;t working.  </p>
<p>I had actually tried doing this in the previous tutorial because I was getting annoyed at having to tab all the time.  When I realized it wasn&#8217;t working with the Form_Load event and the .Focus(), I tried by changing the tab Index to 0 (again, in the form_load event).  That worked.  When i tried the method here by putting it in the frmLogin_Activated section, it doesn&#8217;t work.  </p>
<p>Any suggestions?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
