Closed DukeX94 closed 6 years ago
Field 'Access' doesn't have a default value Can you show me the structure of your database?
Try to create a new table "accounts" with SQL in phpmyadmin:
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
CREATE TABLE `accounts` (
`UID` bigint(20) UNSIGNED NOT NULL,
`Social_ID` varchar(16) NOT NULL,
`Name` varchar(24) NOT NULL,
`Password` varchar(256) NOT NULL,
`Access` smallint(6) NOT NULL,
`Cash` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE `accounts`
ADD UNIQUE KEY `UID` (`UID`);
ALTER TABLE `accounts`
MODIFY `UID` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
COMMIT;
I am currently at work ... As soon as I am at home I will send you the structure of my database and try out your variant.
My Database Struct -->
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
CREATE TABLE accounts
(
UID
bigint(20) UNSIGNED NOT NULL,
Social_ID
varchar(16) NOT NULL,
Name
varchar(24) NOT NULL,
Password
varchar(256) NOT NULL,
Access
tinyint(4) NOT NULL,
Cash
int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE accounts
ADD UNIQUE KEY UID
(UID
);
ALTER TABLE accounts
MODIFY UID
bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
I have now used their database structure and unfortunately still have the same error...
https://github.com/lJohhnyl/Corso-RolePlay-GT-MP-/blob/4cd65fac712b4732f3cdb4cccf73bf814530950d/mysql.cs#L48
if Access
not null, need to fiil all values when inserting or use default values
and the PlayerExist check does not work... :/
If you delete the column "Access" then the register system but after disconnect we no longer recognized the account
@DukeX94 try to debug if playerExists work:
public static bool playerExists(Client player)
{
connection = new MySqlConnection(myConnectionString);
command = connection.CreateCommand();
command.CommandText = "SELECT * FROM accounts";
connection.Open();
Reader = command.ExecuteReader();
while (Reader.Read())
{
string name = Reader.GetString("Social_ID");
if (name == player.name.ToString())
{
func.Debug(true, "playerExists");
Reader.Close();
connection.Close();
return true;
}
}
func.Debug(false, "playerExists");
connection.Close();
return false;
}
@lJohhnyl the debug does not work. I always get after registering always the register window
I have no such problem ... I'll try to fix it, thanks.
@lJohhnyl i have the problem too with login :(
15:23:46.244 | Error | ScriptingEngine | EXCEPTION IN RESOURCE Corso-RolePlay INSIDE SCRIPTENGINE player_event MySql.Data.MySqlClient.MySqlException (0x80004005): Field 'Access' doesn't have a default value
bei MySql.Data.MySqlClient.MySqlStream.ReadPacket()
bei MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int32& insertedId)
bei MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId)
bei MySql.Data.MySqlClient.MySqlDataReader.NextResult()
bei MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
bei MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
bei MySQL.Database.Register_Account(Client player, String Social_ID, String Name, String Password)
bei player_event.OnClientEventTrigger(Client player, String eventName, Object[] arguments)
bei GrandTheftMultiplayer.Server.Models.ScriptingEngine.<>c__DisplayClass58_0.
i have the problem too with login too Please Help me
2018-02-05 12:39:20.2437 | Error | ScriptingEngine | EXCEPTION IN RESOURCE CorsoRP INSIDE SCRIPTENGINE player_event MySql.Data.MySqlClient.MySqlException (0x80004005): Field 'id' doesn't have a default value
at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int32& insertedId)
at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId)
at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
at MySQL.Database.Register_Account(Client player, String Social_ID, String Name, String Password)
at player_event.OnClientEventTrigger(Client player, String eventName, Object[] arguments)
at GrandTheftMultiplayer.Server.Models.ScriptingEngine.<>c__DisplayClass58_0.
@sriwanich , it's problem on ur side. Give ID a default value.
Try this:
ALTER TABLE accounts MODIFY COLUMN Access SMALLINT NOT NULL DEFAULT ''
2018-01-07 23:33:10.2242 | Error | ScriptingEngine | EXCEPTION IN RESOURCE corso INSIDE SCRIPTENGINE player_event MySql.Data.MySqlClient.MySqlException (0x80004005): Field 'Access' doesn't have a default value bei MySql.Data.MySqlClient.MySqlStream.ReadPacket() bei MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int32& insertedId) bei MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId) bei MySql.Data.MySqlClient.MySqlDataReader.NextResult() bei MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) bei MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery() bei MySQL.Database.Register_Account(Client player, String Social_ID, String Name, String Password) bei player_event.OnClientEventTrigger(Client player, String eventName, Object[] arguments) bei GrandTheftMultiplayer.Server.Models.ScriptingEngine.<>c__DisplayClass58_0.b__0()
bei GrandTheftMultiplayer.Server.Models.ScriptingEngine.MainThreadLoop()
does not work for me... :(