Conversion from Access to MySQL
Greetings all. I have a small problem that maybe someone can assist me to the easiest, clearer answer to. I have an application that has been developing in the last months using Visual Basic 2008 Express with Access 2007. In the last weeks I have been converting it to MySQL for my database. i am having problems in configurating vb.net for using mysql. Also converting my existing code to work with MySQL .I use many datagridviews in the winforms and bounded textboxes, etc. How do make them work with a database in mysql. In vb.net when I try to connect to a mysql database the program does not give me an option for a MySQL data source. here is an example in my code where I connect insert and user a reader in the Access database. Thanks for the help.
Greetings all. I have a small problem that maybe someone can assist me to the easiest, clearer answer to. I have an application that has been developing in the last months using Visual Basic 2008 Express with Access 2007. In the last weeks I have been converting it to MySQL for my database. i am having problems in configurating vb.net for using mysql. Also converting my existing code to work with MySQL .I use many datagridviews in the winforms and bounded textboxes, etc. How do make them work with a database in mysql. In vb.net when I try to connect to a mysql database the program does not give me an option for a MySQL data source. here is an example in my code where I connect insert and user a reader in the Access database. Thanks for the help.
VB.NET:
Dim conn As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\KoRnHoLiOs\Documents\Database2.accdb;Persist Security Info=False;")
If CheckBox1.Checked = False And TextBox4.Visible = False Then
conn.Open()
Dim SQL As String
Dim reader As OleDbDataReader
SQL = "insert into Services (ServiceName, .........)values ('" & Me.ServiceComboBox.Text & "', '" & Me.nameTextBox.Text & "',........ )"
Dim cmd As OleDbCommand = New OleDbCommand(SQL, conn)
cmd.ExecuteNonQuery()
Dim sql2 As String = " select ServiceID from Services where ServiceID = " & Me.TextBox1.Text & ""
Dim cmd2 As OleDbCommand = New OleDbCommand(sql2, conn)
reader = cmd2.ExecuteReader()
reader.Read()
Dim serv As Integer = CInt(reader("ServiceID").ToString)
Dim sql1 As String
sql1 = "insert into AllServices (ServiceName, ........) values ('" & Me.ServiceComboBox.Text & "', " & Me.CustidTextBox.Text & ", ..... " & serv & ")"
Dim cmd1 As OleDbCommand = New OleDbCommand(sql1, conn)
cmd1.ExecuteNonQuery()
conn.Close()
Last edited: