Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 8th, 2012, 11:47 PM
dp_UpperKlass dp_UpperKlass is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 2 dp_UpperKlass User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 34 sec
Reputation Power: 0
Problem connecting VB 2010 to MySql database

only the exception is being executed... where did i go wrong


Code:
        Dim myConnString = ";" & _
        "Database = inventory;" & _
        "Uid = root;" & _
        "Pwd = root;" & _
        "Connect Timeout = 30;"

        Dim myconnection As New MySqlConnection(myConnString)
        Dim command As New MySqlCommand("INSERT INTO tblcustomer(CustomerID, FirstName, LastName, Address, StateProvince, ZipCode, Phone, Fax ) VALUES (@id, @fName, @lName, @addr, @state, @zip, @country, @cNumber, @fax)", myconnection)


        command.Parameters.AddWithValue("@id", id.Text)
        command.Parameters.AddWithValue("@fName", fName.Text)
        command.Parameters.AddWithValue("@lName", lName.Text)
        command.Parameters.AddWithValue("@addr", addr.Text)
        command.Parameters.AddWithValue("@state", state.Text)
        command.Parameters.AddWithValue("@zip", zip.Text)
        command.Parameters.AddWithValue("@country", country.Text)
        command.Parameters.AddWithValue("@cNumber", cNumber.Text)
        command.Parameters.AddWithValue("@fax", fax.Text)



        Try
            myconnection.Open()
            command.ExecuteNonQuery()

        Catch
            MessageBox.Show("Error")
        Finally
            myconnection.Close()
        End Try

Reply With Quote
  #2  
Old November 9th, 2012, 02:21 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Jun 2003
Posts: 14,239 Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 15 h 17 m
Reputation Power: 4445
Did you install the mysql odbc drivers on yout machine? I'm guessing not, since your connection string doesn't specify what database server you want to use.

There are sample connection strings on the mysql website. You'll have to look for information over there, mysql isn't a microsoft product.
__________________
======
Doug G
======
It is a truism of American politics that no man who can win an election deserves to. --Trevanian, from the novel Shibumi

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Problem connecting VB 2010 to MySql database

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap