C#sql数据库不会保存任何数据 [英] C# sql database won't save any data

查看:102
本文介绍了C#sql数据库不会保存任何数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有这个空间客户端/服务器游戏,它使用sql数据库来存储数据(登录名,密码等等)。数据库创建发生在SQL Server Management Studio 2005中,然后我必须创建一个空数据库并执行sql查询以使数据库与服务器匹配。



数据库是除非你攻击(参与)然后在游戏中取消攻击(脱离)机器人(AI),否则工作正常。然后它不会将数据保存到数据库(例如,当创建新角色,注销游戏然后尝试登录时,它说不同的密码 - 数据没有保存到数据库中)。



经过几个小时的研究后,我发现导致错误的确切代码:



So i have this space client/server game that uses sql database to store data (loginname, password, etc, etc). The database creation happens in SQL Server Management Studio 2005, then i have to make a empty database and execute sql query to make the database match the server.

The database is working fine unless you attack (engage) and then cancel the attack (disengage) a bot (AI) in the game. Then it wont save data to the database (e.g when create new character, log off the game and then try to logon, it says different password - data wasn't saved to the database).

After hours of researching i found the exact code that cause the bug:

DatabasePlayerAdapter.set_UserEngageCheck(check, BotMemory.BotNameToCheck(Victom));





所以我假设它发生在.set_UserEngageCheck中,它位于DatabasePlayerAdaptes.cs文件中在项目中。这是代码:







So i assume it happens in the .set_UserEngageCheck, which is located in the DatabasePlayerAdaptes.cs file in the project. Here's the code:


public static int get_UserEngageCheck(int i)
{
    return get_Player(i).EngageCheck;
}





任何想法如何解决这个问题?谢谢!



我尝试了什么:



没什么。刚发现bug实际发生的地方。我对C#很陌生,所以我真的不知道如何修复。



Any ideas how do i fix this ? Thanks!

What I have tried:

Nothing really. Just found out where the bug actually occurs. I am pretty new to C# so i don't really know how to fix.

推荐答案

正如Sinisa所提到的,只有你可以调试它。我们无法运行您的代码,也看不到正在发生的事情。进入每个函数以找到问题的实际位置。
As Sinisa mentioned, only you can debug this. We can't run your code and can't see what is happening. Step into each function to find where the problem actually is.


这篇关于C#sql数据库不会保存任何数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆