RSS

Tag Archives: mysql

MySQL: Table ‘SOME_TABLE’ doesn’t exist whereas it does exist


In recent development, I tried to connect MySQL database locally in my C# application, and it worked fine. But when I created the same database and tables using sql script in Ubuntu, and using the same application to connect the mysql database, below error/exception occurred:

Table ‘SOME_TABLE’ doesn’t exist

Logging into MySQL and I found the table does exist:

use mydb;
show tables;

Read the rest of this entry »

Advertisements
 
Leave a comment

Posted by on July 15, 2015 in Programming

 

Tags: , , ,

Using MySQL with C# (III): Coding in C#


  • Install the nuget package: in the nuget management console, type below line and run

Install-Package MySql.Data

  • Let’s create a class SqlUtils, and in the static constructor, type below code:
                
                  static
    SqlUtils()
            {
                try
                {
                    con = new MySqlConnection(connectionStr);
                    con.Open(); //open the connection
                    Console.WriteLine(“Successfully opened database.”);
                }
                catch (MySqlException err) //Catch MySql errors
                {
                    Console.WriteLine(“Error: “ + err.ToString());
                }
            }

where the connection string is:

Read the rest of this entry »

 
1 Comment

Posted by on July 13, 2015 in Dotnet/C#, Programming

 

Tags: , , , , , ,

Using MySQL with C# (II): Creating a DB for programming


You might be interested in how to install MySQL in windows, check up this link for details.

  • Run MySQL workbench after clicking Finish

image_thumb[23]  image_thumb[24]

  • In the MySQL workbench, copy below scripts to create a new database called “MyBooks”:

create database MyBooks

  • Select the above script line, then click the thunder icon to execute the sql statement
  • A new DB is created, as shown in the left DB group:

image   image

Read the rest of this entry »

 
1 Comment

Posted by on July 13, 2015 in Dotnet/C#, Programming

 

Tags: , , , , , ,

Using MySQL with C# (I): MySQL Installation


MySQL is a free database and can be easily used in your .Net Applications. This quick-start goes through the typical process that involves installation, up and running your “Hello MySQL” application.

If you are not interested in the MySQL installation, skip this and go directly to the below topics:

Using MySQL with C# (II): Creating a DB for programming
Using MySQL with C# (III): Coding in C#

  • Download MySQL server here or if you already had an oracle account, go directly here.
  • Accept the license, and select the product/platform to download, click “Go”
  • Download the installer

image  image

  • Unzip and run the installer, follow the instructions.
  • Select the options, in my case, I choose “Full”

Read the rest of this entry »

 
1 Comment

Posted by on July 13, 2015 in Dotnet/C#, Programming

 

Tags: , , , , , , ,