[Help] SQL to INI

07/24/2009 08:00 nestreys#1
how can i convert mysql to ini? can someone help me. Thanks.
07/24/2009 08:28 f0am#2
Well INSERT is like Write i think :D
07/24/2009 09:00 Arcotemple:)#3
lol smarta*s
07/24/2009 09:14 tanelipe#4
Alright this should do it. I'm not familiar with MySQL so do the corrections on classes/mysql syntax. I've provided you with a simple account transfer, there is also a really really simple ini class.

PHP Code:
public static void TransferAccounts(string Table) {

    
MySqlCommand Command MySqlCommand("SELECT * FROM `Table`");
    
MySqlDataReader DR Command.ExecuteReader(); // Or something similar.
    
while(DR.Read()) {
        
// These are just examples. We're 'trimming' them incase there is white spaces.
        
string Username = (DR["Username"] as string).Trim();
        
string Password = (DR["Password"] as string).Trim();

        
IniFile iFile = new IniFile("D:\\ConquerServer\\Database\\Accounts\\" Username ".ini");
        if(!
iFile.Exists) {
            
// Assuming that we don't want to override any existing accounts.
            
iFile.WriteString("Accounts""Username"Username);
            
iFile.WriteString("Accounts""Password"Password);
        }
    }
    
DR.Close();

PHP Code:
class IniFile
    
{
        [
DllImport("kernel32.dll"CharSet CharSet.AnsiSetLastError trueExactSpelling true)]
        private static 
extern int GetPrivateProfileStringA(string Sectionstring Keystring Default, StringBuilder Bufferint BufferSizestring FileName);
        [
DllImport("kernel32.dll"CharSet CharSet.AnsiSetLastError trueExactSpelling true)]
        private static 
extern int WritePrivateProfileStringA(string Sectionstring Keystring Valuestring FileName);
        private 
string Location;
        private 
bool Found;

        public 
IniFile(string Location)
        {
            
this.Location Location;
            
this.Found File.Exists(Location);
        }
        public 
bool Exists get { return Found; } }
        public 
void WriteString(string Sectionstring Keystring Value)
        {
           
                
WritePrivateProfileStringA(SectionKeyValueLocation);
        }
    } 
07/24/2009 16:34 Pete1990#5
Dont go to ini its not gonna help with accounts freezing
07/24/2009 16:38 nestreys#6
Oh okay Pete. Thanks.