Problem with database Saving

04/18/2012 05:33 shadowman123#1
i made Cloudsaint jar Table but its not working

heres my codes

Code:
using System;
using System.IO;
using System.Text;
using Conquer_Online_Server.ServerBase;
using System.Collections.Generic;
using Conquer.Database;

namespace Conquer_Online_Server.Database
{
    public class JarTable
    {
        public enum States : ushort
        {
            HaventStarted = 0,
            Stared = 1
        }
        public uint Kills, Required, Count, State, Type;
        public string Player;
        public JarTable(string player)
        {
            this.Player = player;
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
            cmd.Select("CloudSaint").Where("Name", player);
            MySqlReader r = new MySqlReader(cmd);
            if (r.Read())
            {
                this.Kills = r.ReadUInt32("Kills");
                this.Type = r.ReadUInt32("Type");
                this.Required = r.ReadUInt32("Required");
                this.Count = r.ReadUInt32("Count");
                this.State = r.ReadUInt32("Started");
                this.Player = r.ReadString("Name");

            }
            r.Close();
        }
        public void UpdateJar()
        {
            Database.MySqlCommand cmd = new Database.MySqlCommand(Database.MySqlCommandType.UPDATE);
            cmd.Update("CloudSaint").Set("Required", Required).Set("Kills", Kills).Set("Started", State).Set("Count", Count).Set("Type", Type).Where("Name", Player).Execute();
        }
    }
}
when i get the Jar nothing inserted Into the Table Coloumns

Have i missed smthing ?
04/18/2012 10:33 Korvacs#2
When you create the jar you read from the database, not write. The only time you write is when you update the jar, but you perform an update and not an insert, so yeah i would say you missed quite alot.
04/18/2012 15:27 turk55#3
like Korvacs said, you only update them but there is nothing to update so you have to make it insert a line first and that way you can update it everytime there is a kill.
04/20/2012 04:23 awesome100able#4
f5
04/20/2012 10:21 I don't have a username#5
Quote:
Originally Posted by awesome100able View Post
f5
Such informative post!
04/21/2012 00:01 awesome100able#6
Quote:
Originally Posted by I don't have a username View Post
Such informative post!
LOL