LCKB
[C# - MySql] LC Warehouse! - Printable Version

+- LCKB (https://lckb.dev/forum)
+-- Forum: ** OLD LCKB DATABASE ** (https://lckb.dev/forum/forumdisplay.php?fid=109)
+--- Forum: Programmers Gateway (https://lckb.dev/forum/forumdisplay.php?fid=196)
+---- Forum: Coders Talk (https://lckb.dev/forum/forumdisplay.php?fid=192)
+---- Thread: [C# - MySql] LC Warehouse! (/showthread.php?tid=1100)



- Nikolee - 09-09-2012


Hey i continue to working on a Tool for my Server , but i got a little Problem with MySql i created this Command

@"INSERT INTO `t_stash03`(`a_index`, `a_user_idx`, `a_item_idx`, `a_plus`, `a_wear_pos`, `a_flag`, `a_serial`, `a_count`, `a_used`, `a_item_option0`, `a_item_option1`, `a_item_option2`, `a_item_option3`, `a_item_option4`, `a_used_2`) VALUES (''," + user_id + ",'"+TitanHelm+"','25','-1','0','','1','-1','0','0','0','0','0','-1')";

 

I can insert the Command all works fine, i can find it in the DB , but only in the Warehouse the Item is missing.

 

I think its maybe the Serial but i havent no idea how to Calculate this Serial..^^




- SeaLife - 09-10-2012

i think, the game dont use this database... not implemented?




- HateMe - 09-10-2012

t_stash is right for wearehouse, the best is if someone has already something in wearehouse and u insert it in the right t_stash where he has already the other item but not sure if this also works, the location of t_stash should be where t_character is




- Nikolee - 09-10-2012



t_stash is right for wearehouse, the best is if someone has already something in wearehouse and u insert it in the right t_stash where he has already the other item but not sure if this also works, the location of t_stash should be where t_character is

 

Help me out, i will need to select all from all stash the user_id ?

 

How i can include this in my Code i really dont understand it how to return the selected mysql result in a variable.

 

string user_id = textBox35.Text;
string sqlHelm = @"INSERT INTO t_stash00 (a_user_idx, a_item_idx, a_serial, a_count, a_used, a_plus)
VALUES ('"+user_id+"', '"+TitanHelm+"', 'MNIKSHJF54', '1', '-1', '25' )";

MySqlConnection con;
MySqlConnectionStringBuilder csb = new MySqlConnectionStringBuilder();
csb.Server = Server;
csb.UserID = user;
csb.Database = _Chardb;
csb.Password = pw;
con = new MySqlConnection(csb.ConnectionString);
MySqlConnection connection = new MySqlConnection(csb.ConnectionString);
connection.Open();

MySqlCommand insertBann = new MySqlCommand(sqlHelm, connection);
int i = insertBann.ExecuteNonQuery();




- someone - 09-10-2012


After you execute the query you should get an result. According to that result where you have to parse that result:

 

MySqlDataReader myReader = insertBann.ExecuteReader();
try{
//reading rows if the result are multiple rows
while(myReader.Read()){
//if for every column you could use myReader.GetInt32(0), myReader.GetString(0),
//where 0 is the column number(0 first column, 1 second column,...)
int i =myReader.GetInt32(0);
}
}finally{
myReader.close();
connection.close();
}




- Nikolee - 09-10-2012



After you execute the query you should get an result. According to that result where you have to parse that result:

 

MySqlDataReader myReader = insertBann.ExecuteReader();
try{
//reading rows if the result are multiple rows
while(myReader.Read()){
//if for every column you could use myReader.GetInt32(0), myReader.GetString(0),
//where 0 is the column number(0 first column, 1 second column,...)
int i =myReader.GetInt32(0);
}
}finally{
myReader.close();
connection.close();
}

 

i Know that but i want the the Result of the MySql Select in a Variable i try it later out^^




- TheEvilAnt - 09-19-2012

I already do a similar tool is easy to do just get the last number of the user id if it is9 insert in t_stash09 Serial will be done itself




- Nikolee - 09-22-2012



I already do a similar tool is easy to do just get the last number of the user id if it is9 insert in t_stash09 Serial will be done itself

 

Already fixxed it