[Help]VIP System

12/14/2008 20:47 Weezz#1
First i want u guys to know im just a beginer about c# and stuff...
Second, u will notice that im not so good about english typing >.<

ive coded a LOTF source and made my own custom server

Now im developing a VIP system. i made many things work but theres still something i couldnt code then i came to ask for help.

Definition:i want to make a form connected to db for VIP member login and get the server upgrades and so on.

im working with my friend but we got some troubles with the code
all we need is get the form connected to DB and indentify the ids and passes

theres the coe we made:

Code:
string User = "";
                string Pass = "";
                MySqlCommand Command = new MySqlCommand("SELECT * From `UserIds` SET `Pass` = '" + Pass + "' WHERE `User` = '" + User + "'", DataBase.NewConnection);
                Command.ExecuteNonQuery();
                if (textBox1.Text == "" && textBox2.Text == "")
                {
                    MessageBox.Show("logged sucessfully!!", "Ready", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    _thread = new Thread(new ParameterizedThreadStart(FormStart));
                    _thread.Start();
                    Close();
                }
                else
                {
                    MessageBox.Show("Usuario ou Senha Esta incorreta!!", "Ready", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception E)
            {
                MessageBox.Show(E.ToString(), "Error , Voce nao consiguiu Logar!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
    }
}
12/14/2008 21:01 felipeboladao#2
lol Nice idea
12/14/2008 21:13 Weezz#3
Yeah the ideia is great but its not working right as i want =/

i hope some one come to help
12/14/2008 21:17 YukiXian#4
What you mean with that "Definition" and "a form connected to db for VIP member login and get the server upgrades" ??
12/14/2008 23:21 Weezz#5
look the pic atached...

i just want that to get the DataBase informations and check if id and pass are corect...

the rest ive fixed
12/14/2008 23:51 _Emme_#6
Make it the easier way;

Console.Write("Database Username : ");
string User = Console.ReadLine();
Console.Write("Database Password : ");
string Pass = Console.ReadLine();

if (User == Database.UserName && Pass == Database.Password)
{
BLABLA
}
else
{
Console.WriteLine("Wrong information!!");
}
12/15/2008 02:54 Weezz#7
Quote:
Originally Posted by EmmeTheCoder View Post
Make it the easier way;

Console.Write("Database Username : ");
string User = Console.ReadLine();
Console.Write("Database Password : ");
string Pass = Console.ReadLine();

if (User == Database.UserName && Pass == Database.Password)
{
BLABLA
}
else
{
Console.WriteLine("Wrong information!!");
}

YAY!! DID WORK !! THKS EMME :D

note: i might think about it before :D
12/15/2008 05:08 felipeboladao#8
Help me is my code...
;D
Variables:

string User = " + TextBox1.text + ";
string Pass = " + TextBox1.text + ";

private void button1_Click_1(object sender, EventArgs e)
{
try
{
if (User == "" && Pass == "")
{
MessageBox.Show("Logado com Sucesso!!", "Ready", MessageBoxButtons.OK, MessageBoxIcon.Information);
_thread = new Thread(new ParameterizedThreadStart(FormStart));
_thread.Start();
Close();
}
else
{
MessageBox.Show("Usuario ou Senha Esta incorreta!!", "Ready", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (Exception E)
{
MessageBox.Show(E.ToString(), "Error , Voce nao consiguiu Logar!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
}
}
12/15/2008 05:22 kinshi88#9
private void button1_Click_1(object sender, EventArgs e)
{
User = " + TextBox1.text + ";
Pass = " + TextBox1.text + ";
try
{
if (User == "" && Pass == "")
{
MessageBox.Show("Logado com Sucesso!!", "Ready", MessageBoxButtons.OK, MessageBoxIcon.Information);
_thread = new Thread(new ParameterizedThreadStart(FormStart));
_thread.Start();
Close();
}
else
{
MessageBox.Show("Usuario ou Senha Esta incorreta!!", "Ready", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (Exception E)
{
MessageBox.Show(E.ToString(), "Error , Voce nao consiguiu Logar!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
}
}


That should fix it.
12/15/2008 05:33 felipeboladao#10
Error 5 The name 'User' does not exist in the current context C:\Documents and Settings\Diego - Servidor\Desktop\Conquer Online\Sparks CO Project\Form1.cs 55 21 COServerProject

Help me ,plx ;D
12/15/2008 12:19 YukiXian#11
Quote:
Originally Posted by felipeboladao View Post
Error 5 The name 'User' does not exist in the current context C:\Documents and Settings\Diego - Servidor\Desktop\Conquer Online\Sparks CO Project\Form1.cs 55 21 COServerProject

Help me ,plx ;D
Don't be stupid, Make a string of it,,,
12/16/2008 01:07 felipeboladao#12
help me to conect at The Database ...

Code:
private void button1_Click_1(object sender, EventArgs e)
        {
            User = " + TextBox1.text + ";
            Pass = " + TextBox1.text + ";
            try
            {
                User = "";
                Pass = "";
                    MySqlCommand Command = null;
                    Command = new MySqlCommand("SELECT * FROM `Users` WHERE `User` = '" + Pass + "' WHERE `Pass` = '" + Pass + "'", DataBase.Connection);
                    Command.ExecuteNonQuery();
                if (User == " + User + " && Pass == " + Pass + ")
                {
                    MessageBox.Show("Logado com Sucesso!!", "Ready", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    _thread = new Thread(new ParameterizedThreadStart(FormStart));
                    _thread.Start();
                    Close();
                }
                else
                {
                    MessageBox.Show("Usuario ou Senha Esta incorreta!!", "Ready", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception E)
            {
                MessageBox.Show(E.ToString(), "Error , Voce nao consiguiu Logar!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
    }
}