Click here to Skip to main content
15,888,454 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questionvb6 migration to .net Pin
costavo24-Jun-08 1:54
costavo24-Jun-08 1:54 
AnswerRe: vb6 migration to .net Pin
Christian Graus24-Jun-08 2:51
protectorChristian Graus24-Jun-08 2:51 
AnswerRe: vb6 migration to .net Pin
Chaitanya kumar CVSS25-Jun-08 2:59
Chaitanya kumar CVSS25-Jun-08 2:59 
Questionconverting from SQL server to MySql Pin
ttilque24-Jun-08 1:49
ttilque24-Jun-08 1:49 
AnswerRe: converting from SQL server to MySql Pin
Christian Graus24-Jun-08 1:53
protectorChristian Graus24-Jun-08 1:53 
AnswerRe: converting from SQL server to MySql Pin
jzonthemtn24-Jun-08 6:38
jzonthemtn24-Jun-08 6:38 
GeneralRe: converting from SQL server to MySql Pin
ttilque24-Jun-08 10:42
ttilque24-Jun-08 10:42 
GeneralRe: converting from SQL server to MySql Pin
jzonthemtn24-Jun-08 10:54
jzonthemtn24-Jun-08 10:54 
Sure. This is probably how your code using SQL Server looks:

Imports System.Data.SqlClient

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim DatabaseConnection As New SqlConnection("connectionstringgoeshere")

        DatabaseConnection.Open()

        Dim SQLCommand As New SqlCommand("SELECT * FROM TABLE", DatabaseConnection)
        SQLCommand.ExecuteNonQuery()

        DatabaseConnection.Close()

    End Sub

End Class


Now, after you have downloaded and installed the MySql Connector/Net, open the project's properties, click References, click Add, and add C:\Program Files\MySQL\MySQL Connector Net 5.1.6\Binaries\.NET 2.0\MySql.Data.dll. That's the default directory, it may be somewhere else on your computer. Next, change your code to MySql. I bolded the changes:

Imports MySql.Data.MySqlClient

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim DatabaseConnection As New MySqlConnection("connectionstringgoeshere")

        DatabaseConnection.Open()

        Dim SQLCommand As New MySqlCommand("SELECT * FROM TABLE", DatabaseConnection)
        SQLCommand.ExecuteNonQuery()

        DatabaseConnection.Close()

    End Sub

End Class


Again referring back to what Christian said earlier, as long as you don't do any SQL Server-specific queries you should pretty much be able to just replace the SQL Server stuff with the MySql stuff. Make sure to update your connection string to be for MySql. (You can also use OleDbConnection if you don't want to use the MySql Connector.)

Hope this helps...
GeneralRe: converting from SQL server to MySql Pin
ttilque25-Jun-08 3:22
ttilque25-Jun-08 3:22 
QuestionNeed to open an image file, like jpg ? Pin
masoodp66624-Jun-08 1:33
masoodp66624-Jun-08 1:33 
AnswerRe: Need to open an image file, like jpg ? Pin
Christian Graus24-Jun-08 1:53
protectorChristian Graus24-Jun-08 1:53 
GeneralRe: Need to open an image file, like jpg ? Pin
masoodp66624-Jun-08 3:55
masoodp66624-Jun-08 3:55 
GeneralRe: Need to open an image file, like jpg ? Pin
Christian Graus24-Jun-08 11:33
protectorChristian Graus24-Jun-08 11:33 
AnswerRe: Need to open an image file, like jpg ? Pin
Karrar Ketawi24-Jun-08 10:29
Karrar Ketawi24-Jun-08 10:29 
QuestionPrimary Key checking Pin
rrrriiizz24-Jun-08 1:13
rrrriiizz24-Jun-08 1:13 
AnswerRe: Primary Key checking Pin
Marek Grzenkowicz24-Jun-08 3:10
Marek Grzenkowicz24-Jun-08 3:10 
GeneralRe: Primary Key checking Pin
rrrriiizz24-Jun-08 18:27
rrrriiizz24-Jun-08 18:27 
QuestionOutlook COM Addin deployment on Terminal server Pin
manisghouri24-Jun-08 0:45
manisghouri24-Jun-08 0:45 
AnswerRe: Outlook COM Addin deployment on Terminal server Pin
~Khatri Mitesh~24-Jun-08 1:57
~Khatri Mitesh~24-Jun-08 1:57 
GeneralRe: Outlook COM Addin deployment on Terminal server Pin
manisghouri24-Jun-08 2:48
manisghouri24-Jun-08 2:48 
GeneralRe: Outlook COM Addin deployment on Terminal server Pin
manisghouri24-Jun-08 7:47
manisghouri24-Jun-08 7:47 
GeneralRe: Outlook COM Addin deployment on Terminal server Pin
~Khatri Mitesh~24-Jun-08 19:56
~Khatri Mitesh~24-Jun-08 19:56 
GeneralRe: Outlook COM Addin deployment on Terminal server Pin
manisghouri25-Jun-08 7:38
manisghouri25-Jun-08 7:38 
GeneralRe: Outlook COM Addin deployment on Terminal server Pin
~Khatri Mitesh~25-Jun-08 20:43
~Khatri Mitesh~25-Jun-08 20:43 
GeneralRe: Outlook COM Addin deployment on Terminal server Pin
manisghouri29-Jun-08 23:45
manisghouri29-Jun-08 23:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.