, i have used vs & mysql but now i'm lost.. I have looked online but the examples dont work on my machine (windows 10 running VS2019.
I have placed the using statements
in my code but that doesnt resolve ..... OdbcCommand command = new OdbcCommand(queryString);
help below is a piece of code i copied from the internet. the compiler gives me errors on the using statement.
i added the commenting-out .
I have placed the using statements
C#:
using MySql.Data;
using MySql.Data.MySqlClient;
in my code but that doesnt resolve ..... OdbcCommand command = new OdbcCommand(queryString);
help below is a piece of code i copied from the internet. the compiler gives me errors on the using statement.
i added the commenting-out .
C#:
/* ======================================================
using System;
using MySql.Data;
using MySql.Data.MySqlClient;
namespace localdb
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
InsertRow(@"localhost/mydb");
}
static void InsertRow(string connectionString)
{
string queryString =
"INSERT INTO Customers (CustomerID, CompanyName) Values('NWIND', 'Northwind Traders')";
OdbcCommand command = new OdbcCommand(queryString);
using (OdbcConnection connection = new OdbcConnection(connectionString))
{
command.Connection = connection;
connection.Open();
command.ExecuteNonQuery();
// The connection is automatically closed at
// the end of the Using block.
}
}
}
}
======================================================
*/
Last edited by a moderator: