erro de sintaxe que não me deixa criar uma tabela no meu banco de dados

Andrei Radu:

Então, eu tenho o seguinte código:

String SQLString = $"CREATE TABLE IF NOT EXISTS `accounts` (" +
                                $"`SQLID` INT(11) NOT NULL AUTO_INCREMENT," +
                                $"`socialClub` VARCHAR(64) NOT NULL DEFAULT \"\"," +
                                $"`userName` VARCHAR(64) NOT NULL DEFAULT \"\"," +
                                $"`Cash` INT(11) NOT NULL DEFAULT `0`," +
                                $"`Level` INT(11) NOT NULL DEFAULT `1`," +
                                $"`Age` INT(11) NOT NULL DEFAULT `0`," +
                                $"`Health` INT(6) NOT NULL DEFAULT `1`," +
                                $"PRIMARY KEY (`SQLID`));";

E eu recebo o seguinte erro quando ligo o servidor:

        MySql.Data.MySqlClient.MySqlException (0x80004005): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '`0`,`Level` INT(11) NOT NULL DEFAULT `1`,`Age` INT(11) NOT NULL DEFAULT `0`,`Hea' at line 1
       at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
       at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId)
       at MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int64& insertedId)
       at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
       at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
       at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
       at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader()
       at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
É Yennef:

Você incorretamente estão escapando da DEFAULTcláusula. Basta remover os acentos graves e sua consulta é sintaticamente correto.

Acho que você gosta

Origin http://43.154.161.224:23101/article/api/json?id=320798&siteId=1
Recomendado
Clasificación