I get an sql syntax error when trying to insert an record.. Dapper is trying to execute "select scope_identity();" against an MySQL database. How to make Dapper recognize that i,m connecting to MYSQL and not to sql server?
using System;
using Dapper;
using MySql.Data.MySqlClient;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
String sConString = "myconstring_to_an_mysql_database";
using (MySqlConnection connection = new MySqlConnection(sConString))
{
Teste tst = new Teste { id = 1, cod = "0001", nome = "Primeiro teste" };
//error here - sql syntax error - select scope_identity();
var idCli = connection.Insert(tst);
}
Console.ReadLine();
}
}
[Table("Teste")]
public class Teste
{
[Key]
public int id { get; set; }
public string cod { get; set; }
public string nome { get; set; }
}
I get an sql syntax error when trying to insert an record.. Dapper is trying to execute "select scope_identity();" against an MySQL database. How to make Dapper recognize that i,m connecting to MYSQL and not to sql server?
using System; using Dapper; using MySql.Data.MySqlClient;
namespace ConsoleApp1 { class Program { static void Main(string[] args) { String sConString = "myconstring_to_an_mysql_database"; using (MySqlConnection connection = new MySqlConnection(sConString)) { Teste tst = new Teste { id = 1, cod = "0001", nome = "Primeiro teste" }; //error here - sql syntax error - select scope_identity(); var idCli = connection.Insert(tst);
}
}