Register for your free account! | Forgot your password?

You last visited: Today at 16:05

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Grr >.> More Errors >

Discussion on Grr >.> More Errors > within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
-Shunsui-'s Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 1,152
Received Thanks: 321
Grr >.> More Errors >

Well this is my createcharacter class for 5165 and i Type its Name Choose Body Size Wen I click Enter It Gives me The Error Try again i just cant find wats the problem

Code:
using System;
using Source_Project.GameSystem;
using Source_Project.Structures;
using MySql.Data.MySqlClient;

namespace Source_Project
{
    public partial class Database
    {
        public static string CreateCharacter(string Account, string Name, ushort Body, byte Job)
        {
            MySqlConnection Conn = GetConnection(); Conn.Open();

            try
            {
                MySqlCommand Cmd = null;
                string ret = "";
                bool exist = false;
                try
                {
                    lock (Conn)
                    {
                        Cmd = new MySqlCommand("SELECT * FROM `cq_users` WHERE `Name` = '" + Name + "'", Conn);
                        MySqlDataReader DR = Cmd.ExecuteReader();

                        while (DR.Read())
                        {
                            ret = "Name in use.";
                            exist = true;
                        }
                        DR.Close();
                    }
                    Conn.Close();

                    if (exist)
                        return ret;
                }
                catch { }
                byte avatar = 1;
                if (Body != 1003 || Body != 1004)
                    avatar = 201;
                ushort Str = 0, Agi = 0, Vit = 0, Spi = 0;
                GetInitialStats(Job, ref Str, ref Agi, ref Vit, ref Spi);
                ushort HP = (ushort)(Vit * 24 + Str * 3 + Agi * 3 + Spi * 3);
                string Inventory = "";
                string Skills = "";
                Conn = GetConnection();
                lock (Conn)
                {
                    Cmd = new MySqlCommand("INSERT INTO `cq_users` (Account,Name,Avatar,Body,Hair,Job,Str,Agi,Vit,Spi,CurHP,Inventory,Skills) VALUES ('" + Account + "','" + Name + "'," + avatar + "," + Body + "," + (410 + (Program.Rnd.Next(5) * 100)) + "," + Job + "," + Str + "," + Agi + "," + Vit + "," + Spi + "," + HP + ",'" + Inventory + "','" + Skills + "')", Conn);
                    Cmd.ExecuteNonQuery();
                    Cmd = new MySqlCommand("UPDATE `cq_accounts` set `Character` = '" + Name + "' WHERE `AccountID` = '" + Account + "'", Conn);
                    Cmd.ExecuteNonQuery();
                }
                Conn.Close();
            }
            catch { return "Error! Try again."; }

            return "ANSWER_OK";
        }
    }
}
## EDIT this is it writing the line...
-Shunsui- is offline  
Old 05/12/2010, 09:25   #2
 
elite*gold: 0
Join Date: Oct 2009
Posts: 768
Received Thanks: 550
Database connections are not supposed to have a long life. You need to configure your mysql to be able to hold like 500+ connections at one time,
and use this piece of code for a mysql connection.

Code:
using(MySqlConnection Conn = new MySqlConnection("THE STRING HERE"))
{
Conn.Open();

//Use the connection

}

//Connection is already disposed after moving out of the using statement.
-impulse- is offline  
Old 05/12/2010, 11:44   #3
 
_Emme_'s Avatar
 
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,161
Wouldn't it just be easier to learn how to code yourself?
_Emme_ is offline  
Old 05/12/2010, 12:47   #4
 
elite*gold: 0
Join Date: May 2010
Posts: 630
Received Thanks: 130
Quote:
Originally Posted by EmmeTheCoder View Post
Wouldn't it just be easier to learn how to code yourself?
To learn code, dosn't just take 1day.
What would you say, if you had a problem on breathing and then take to the hopsital.
Then the doctor say: "Wouldn't it be easier if you learn to breath"
.Summer is offline  
Old 05/12/2010, 14:11   #5
 
_Emme_'s Avatar
 
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,161
Quote:
Originally Posted by .Summer View Post
To learn code, dosn't just take 1day.
What would you say, if you had a problem on breathing and then take to the hopsital.
Then the doctor say: "Wouldn't it be easier if you learn to breath"
Sigh..

This guy have been asking for help for the most simple problems ever for over a month, within 2 days of online tutorials and reading you would be able to solve half of the problems he have been making threads about.

Or, even worse, I believe a non coder would understand this problem just by taking the little time to read it through, but no, this guy needs to make a thread on a forum.

He could of for example:
Read the problem through, it's clearly saying the connection must be valid and open.
Quote:
Okay, is the connectionstring valid, no typos etc? Hm, no. Alright, have I opened it (connection.Open(); ) - no I have not, there's my mistake!

Quote:
Connection must be valid and open C#
The google one got me tons of answers, wouldn't that take less time than making a thread and waiting for a response?




What I'm saying is not that we should not help people, but when there's faster to use google for such a common problem, do so.
_Emme_ is offline  
Reply


Similar Threads Similar Threads
[Guide] 2 Fixes on Sro-Errors (no bot-errors)
03/04/2011 - SRO Guides & Templates - 5 Replies
Hey guys, here are 2 fixes for silkroad-errors (not bot-errors!). I know they dont appear for many people but some guys have problems with it. 1st Fix: "Server is undergoing inspection..." Why does this error appear? Because Joymax has some problems with the Login-Servers. Fix: Step1): Click on "Start" then on "Run"
my bot gets errors?
06/14/2010 - Ragnarok Online - 2 Replies
i have a auto buffer and it pulls up players as #unknown3453453 and it says cant find player ip 67.202.104.229 port 6900 version 24
[Help] Errors
02/18/2010 - CO2 Private Server - 6 Replies
#request close Thanks spare!
44 Errors.
08/08/2009 - CO2 Private Server - 4 Replies
:l. I implemented a RB guard tutorial thing into my server but I have like so many errors. I removed all of it but i cant find any other releases, and looking through the code its far too complex for me too code my own from scratch. This is the tut: http://www.elitepvpers.com/forum/co2-pserver-discus sions-questions/177649-release-rb-guard.html I think this error causing the rest is 'COServer_Project.SingleMob' does not contain a constructor that takes '15' arguments'
C6-C9 errors ?
03/22/2008 - Silkroad Online - 4 Replies
when i try to log in to silkroad i get thoust C6-C9 Errors ... what should i do ? i Think problem is whit my Internet ... so any suggestions ..?



All times are GMT +2. The time now is 16:05.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.