Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2012 [RESOLVED] Mysql insert statement not working

$
0
0
As usual, i suck when it comes to sql statements, and once again, i have a problem i am hoping i can get fixed. I know in php the statement is like so:
Code:

"INSERT INTO 'mydatabasename'.'zeds' (@guid);", MysqlConn
but whats the the right syntax for this in vb.net?

Code:

MysqlConn = New MySqlConnection()
            MysqlConn.ConnectionString = "server=#; user id=#; password=#; database=#" 'Hashed out for the post
                MysqlConn.Open()
                'Add sql commands
                Dim cmd As New MySqlCommand("INSERT INTO  'zeds' (@guid);", MysqlConn)'
                cmd.Parameters.AddWithValue("@guid", GuidTextBox.Text)
                'MsgBox(SelItem & " Was Imported")
                cmd.ExecuteNonQuery()
                MysqlConn.Close()

I want to insert this statement under these in the screenshot:

Name:  Screenshot_3.png
Views: 39
Size:  12.7 KB

And this is the table i want to write the guid in to:

Name:  Screenshot_4.png
Views: 7
Size:  38.7 KB

zeds is the database table. To be clear, i wanted to insert each as a new row, like GuidTextBox.Text under JoeBlogs

Can someone tell me how I should be writing this please?


Quote:

The above code will work for anyone looking to do same thing. My problem was, in my loooonnnnnggg list of code, was this which was killing my sub because the setting was stored in the program settings before it was reloaded on the form.

Code:

If GuidTextBox.Text = My.Settings.GUID Then
                Exit Sub
            End If

Face palm :D:D:D
Attached Images
  

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>