Access -MySql

gate7cy

Well-known member
Joined
May 11, 2009
Messages
119
Programming Experience
3-5
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.

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:

gate7cy

Well-known member
Joined
May 11, 2009
Messages
119
Programming Experience
3-5
I have experience and know how to use MySql. Ms Sql have got zero experience/knowledge. As I try to enter the database created in Mysql the dataset is shown the visual studio solution explorer. In the datasources no. When I enter the database at this end is says ' failed to create objects in datasource. Could not get type information.' When I created a new test project I entered the same database with no problem and everything got created. I think that Visual Studio does not allow two databases at the same time or does not allow for some other reason an access database together with a MySQL database. Does anyone have any answer to this problem. Thank you for the replies.


ps. daraset created and shown in the solution explorer can be edited and saved just fine. do not know if that helps.

#thankks#
 

gate7cy

Well-known member
Joined
May 11, 2009
Messages
119
Programming Experience
3-5
I have an application in vb.net using Access 2007. I want to migrate to MySQL . I cannot add in VS 2008 a MySQL database as long as I have the access database in the project. As I try to enter the database created in Mysql the dataset is shown the visual studio solution explorer. In the datasources no. When I enter the database at this end is says ' failed to create objects in datasource. Could not get type information.' When I created a new test project I entered the same database with no problem and everything got created. I think that Visual Studio does not allow two databases at the same time or does not allow for some other reason an access database together with a MySQL database. Does anyone have any answer to this problem. Thank you for the replies.


ps. daraset created and shown in the solution explorer can be edited and saved just fine. do not know if that helps.
 
Top Bottom