-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDatabaseHandle.cs
More file actions
521 lines (487 loc) · 24.3 KB
/
Copy pathDatabaseHandle.cs
File metadata and controls
521 lines (487 loc) · 24.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
// Decompiled with JetBrains decompiler
// Type: LcDevPack_TeamDamonA.DatabaseHandle
// Assembly: LcDevPack_TeamDamonA, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 6B9BC8BF-B510-4945-A515-04135CC0F4A4
// Assembly location: C:\Users\NTServer\Desktop\LcDevPack_TeamDamonA\LcDevPack_TeamDamonA\LcDevPack_TeamDamonA.exe
using LcDevPack_TeamDamonA.Tools;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
namespace LcDevPack_TeamDamonA
{
public class DatabaseHandle
{
public static Connection connection = new Connection();
private string Host = DatabaseHandle.connection.ReadSettings("Host");
private string User = DatabaseHandle.connection.ReadSettings("User");
private string Password = DatabaseHandle.connection.ReadSettings("Password");
private string Database = DatabaseHandle.connection.ReadSettings("Database");
private string language = DatabaseHandle.connection.ReadSettings("Language");
private string name;
public List<string> Menu;
private string EncodeMySqlString(string value)
{
return value.Replace("\\", "\\\\").Replace("'", "\\'");
}
public List<string> SearchList(string searchString, string[] rowName, string tableName)
{
searchString = searchString.Replace("\\", "\\\\").Replace("'", "\\'");
string lower = searchString.ToLower();
string upper = searchString.ToUpper();
string str1 = "";
string namee = ""; // set the string equal to empty so it can be filled.
namee = LanguageHelper.StringFromLanguage();
if (searchString.Length > 1)
str1 = char.ToUpper(searchString[0]).ToString() + searchString.Substring(1);
//dethunter12 4/11/2018 language change
string cmdText = "SELECT a_index," + " " + namee + " FROM " + tableName + " WHERE" + " " + namee + " " + "LIKE '%" + searchString + "%'" + " OR a_index LIKE '%" + searchString + "%'" + " OR" + " " + namee + " " + "LIKE '%" + lower + "%' OR a_index LIKE '%" + lower + "%'" + " OR" + " " + namee + " " + "LIKE '%" + upper + "%' OR a_index LIKE '%" + upper + "%'" + " OR" + " " + namee + " " + " LIKE '%" + str1 + "%' OR a_index LIKE '%" + str1 + "%'" + " ORDER BY a_index;"; //dethunter12 test
MySqlConnection connection = new MySqlConnection("datasource=" + Host + ";port=3306;username=" + User + ";password=" + Password + ";database=" + Database);
MySqlCommand mySqlCommand = new MySqlCommand(cmdText, connection);
try
{
Menu = new List<string>();
MySqlDataAdapter mySqlDataAdapter = new MySqlDataAdapter();
mySqlDataAdapter.SelectCommand = mySqlCommand;
DataTable dataTable1 = new DataTable();
mySqlDataAdapter.Fill(dataTable1);
new BindingSource().DataSource = dataTable1;
mySqlDataAdapter.Update(dataTable1);
connection.Open();
DataTable dataTable2 = new DataTable();
mySqlCommand.ExecuteNonQuery();
mySqlDataAdapter.Fill(dataTable2);
Convert.ToString(mySqlCommand.ExecuteScalar());
foreach (DataRow row in (InternalDataCollectionBase)dataTable2.Rows)
{
string str2 = "";
for (int index = 0; index < rowName.Length; ++index)
{
str2 += row[rowName[index]].ToString();
if (index == 0 && rowName.Length > 1)
str2 += " - ";
}
Menu.Add(str2);
}
connection.Close();
return Menu;
}
catch (Exception ex)
{
Menu = new List<string>();
Menu.Add("Error");
int num = (int)MessageBox.Show(ex.Message, "Error!");
return Menu;
}
}
public List<string> SelectMySqlReturnList(string[] rowName, string Host, string User, string Password, string Database, string Query)
{
MySqlConnection connection = new MySqlConnection("datasource=" + Host + ";port=3306;username=" + User + ";password=" + Password + ";database=" + Database);
MySqlCommand mySqlCommand = new MySqlCommand(Query, connection);
try
{
Menu = new List<string>();
MySqlDataAdapter mySqlDataAdapter = new MySqlDataAdapter();
mySqlDataAdapter.SelectCommand = mySqlCommand;
DataTable dataTable1 = new DataTable();
mySqlDataAdapter.Fill(dataTable1);
new BindingSource().DataSource = dataTable1;
mySqlDataAdapter.Update(dataTable1);
connection.Open();
DataTable dataTable2 = new DataTable();
mySqlCommand.ExecuteNonQuery();
mySqlDataAdapter.Fill(dataTable2);
Convert.ToString(mySqlCommand.ExecuteScalar());
foreach (DataRow row in (InternalDataCollectionBase)dataTable2.Rows)
{
string str = "";
for (int index = 0; index < rowName.Length; ++index)
{
str += row[rowName[index]].ToString();
if (index == 0 && rowName.Length > 1)
str += " - ";
}
Menu.Add(str);
}
connection.Close();
return Menu;
}
catch (Exception ex)
{
Menu = new List<string>();
Menu.Add("Error");
int num = (int)MessageBox.Show(ex.Message, "Error!");
return Menu;
}
}
public List<string> SelectMySqlExplodedReturnList(string[] rowName, string Host, string User, string Password, string Database, string Query)
{
Query.Replace("'", "\\'").Replace("\\", "\\\\").Replace("'", "\\'");
MySqlConnection connection = new MySqlConnection("datasource=" + Host + ";port=3306;username=" + User + ";password=" + Password + ";database=" + Database);
MySqlCommand mySqlCommand = new MySqlCommand(Query, connection);
try
{
Menu = new List<string>();
MySqlDataAdapter mySqlDataAdapter = new MySqlDataAdapter();
mySqlDataAdapter.SelectCommand = mySqlCommand;
DataTable dataTable1 = new DataTable();
mySqlDataAdapter.Fill(dataTable1);
new BindingSource().DataSource = dataTable1;
mySqlDataAdapter.Update(dataTable1);
connection.Open();
DataTable dataTable2 = new DataTable();
mySqlCommand.ExecuteNonQuery();
mySqlDataAdapter.Fill(dataTable2);
Convert.ToString(mySqlCommand.ExecuteScalar());
foreach (DataRow row in (InternalDataCollectionBase)dataTable2.Rows)
{
for (int index = 0; index < rowName.Length; ++index)
{
string str1 = row[rowName[index]].ToString();
char[] chArray = new char[1] { ' ' };
foreach (string str2 in str1.Split(chArray))
Menu.Add(str2);
}
}
connection.Close();
return Menu;
}
catch (Exception ex)
{
Menu = new List<string>();
Menu.Add("Error");
int num = (int)MessageBox.Show(ex.Message, "Error!");
return Menu;
}
}
public string[] SelectMySqlReturnArray(string Host, string User, string Password, string Database, string Query, string[] rows)
{
try // Scura Exception Handler [25-05-22]
{
Query.Replace("'", "\\'").Replace("\\", "\\\\").Replace("'", "\\'");
MySqlConnection connection = new MySqlConnection("datasource=" + Host + ";port=3306;username=" + User + ";password=" + Password + ";database=" + Database);
MySqlCommand mySqlCommand = new MySqlCommand(Query, connection);
MySqlDataAdapter mySqlDataAdapter = new MySqlDataAdapter();
mySqlDataAdapter.SelectCommand = mySqlCommand;
DataTable dataTable1 = new DataTable();
mySqlDataAdapter.Fill(dataTable1);
new BindingSource().DataSource = dataTable1;
mySqlDataAdapter.Update(dataTable1);
connection.Open();
DataTable dataTable2 = new DataTable();
mySqlCommand.ExecuteNonQuery();
mySqlDataAdapter.Fill(dataTable2);
Convert.ToString(mySqlCommand.ExecuteScalar());
string[] strArray = new string[rows.Length];
foreach (DataRow row in (InternalDataCollectionBase)dataTable2.Rows)
{
for (int index = 0; index < rows.Length; ++index)
{
row[rows[index]].ToString();
strArray[index] = row[rows[index]].ToString();
}
}
connection.Close();
return strArray;
}
catch (Exception ex) // Scura Catch Exception
{
MessageBox.Show($"Error while connecting into server\n\n{ex}", "Mysql Server Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return null;
}
}
bool abort_connection = false; //Scura - prevent multiple exceptions
public void SendQueryMySql(string Host, string User, string Password, string Database, string Query)
{
if (abort_connection) //Scura
{
MessageBox.Show("Connection Aborted. Re-launch the application!", "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
try
{
Query.Replace("'", "\\'").Replace("\\", "\\\\").Replace("'", "\\'");
MySqlConnection connection = new MySqlConnection("datasource=" + Host + ";port=3306;username=" + User + ";password=" + Password + ";database=" + Database);
MySqlCommand mySqlCommand = new MySqlCommand(Query, connection);
connection.Open();
mySqlCommand.ExecuteReader();
connection.Close();
abort_connection = false;
}
catch (Exception ex)
{
MessageBox.Show($"Error while sending mysql query to server. Exception:\n\n{ex}", "Error");
abort_connection = true;
}
}
public int CountByRow(string Host, string User, string Password, string Database, string Query)
{
MySqlConnection connection = new MySqlConnection("datasource=" + Host + ";port=3306;username=" + User + ";password=" + Password + ";database=" + Database);
MySqlCommand mySqlCommand = new MySqlCommand(Query, connection);
connection.Open();
int int32 = Convert.ToInt32(mySqlCommand.ExecuteScalar());
connection.Close();
return int32;
}
public Bitmap IconFast(int itemID)
{
Image image1 = Image.FromFile("icons/ItemBtn0.png");
Bitmap bitmap1 = new Bitmap(32, 32);
Graphics graphics1 = Graphics.FromImage((Image)bitmap1);
Rectangle srcRect1 = new Rectangle(0, 0, 32, 32);
graphics1.DrawImage(image1, 0, 0, srcRect1, GraphicsUnit.Pixel);
graphics1.Dispose();
if (itemID == -1)
return bitmap1;
ticon ticon = IconList.List.Find((Predicate<ticon>)(p => p.ItemID.Equals(itemID)));
if (ticon == null)
return bitmap1;
int fileId = ticon.FileID;
int row = ticon.Row;
int col = ticon.Col;
Image image2 = Image.FromFile("icons/ItemBtn" + fileId.ToString() + ".png");
Bitmap bitmap2 = new Bitmap(32, 32);
Graphics graphics2 = Graphics.FromImage((Image)bitmap2);
int y = row * 32;
Rectangle srcRect2 = new Rectangle(col * 32, y, 32, 32);
graphics2.DrawImage(image2, 0, 0, srcRect2, GraphicsUnit.Pixel);
graphics2.Dispose();
return bitmap2;
}
public Bitmap SkillsFast(int SkillID)
{
Image image1 = Image.FromFile("icons/SkillBtn0.png");
Bitmap bitmap1 = new Bitmap(32, 32);
Graphics graphics1 = Graphics.FromImage((Image)bitmap1);
Rectangle srcRect1 = new Rectangle(0, 0, 32, 32);
graphics1.DrawImage(image1, 0, 0, srcRect1, GraphicsUnit.Pixel);
graphics1.Dispose();
if (SkillID == -1)
return bitmap1;
SkillIcon SkillIcon = IconSkill.List.Find((Predicate<SkillIcon>)(g => g.SkillID.Equals(SkillID)));
if (SkillIcon == null)
return bitmap1;
int fileId = SkillIcon.FileID;
int row = SkillIcon.Row;
int col = SkillIcon.Col;
Image image2 = Image.FromFile("icons/SkillBtn" + fileId.ToString() + ".png");
Bitmap bitmap2 = new Bitmap(32, 32);
Graphics graphics2 = Graphics.FromImage((Image)bitmap2);
int y = row * 32;
Rectangle srcRect2 = new Rectangle(col * 32, y, 32, 32);
graphics2.DrawImage(image2, 0, 0, srcRect2, GraphicsUnit.Pixel);
graphics2.Dispose();
return bitmap2;
}
public Bitmap ActionFast(int ActionID)
{
Image image1 = Image.FromFile("icons/ActionBtn0.png");
Bitmap bitmap1 = new Bitmap(32, 32);
Graphics graphics1 = Graphics.FromImage((Image)bitmap1);
Rectangle srcRect1 = new Rectangle(0, 0, 32, 32);
graphics1.DrawImage(image1, 0, 0, srcRect1, GraphicsUnit.Pixel);
graphics1.Dispose();
if (ActionID == -1)
return bitmap1;
ActionIcon ActionIcon = IconAction.List.Find((Predicate<ActionIcon>)(g => g.ActionID.Equals(ActionID)));
if (ActionIcon == null)
return bitmap1;
int fileId = ActionIcon.FileID;
int row = ActionIcon.Row;
int col = ActionIcon.Col;
Image image2 = Image.FromFile("icons/ActionBtn" + fileId.ToString() + ".png");
Bitmap bitmap2 = new Bitmap(32, 32);
Graphics graphics2 = Graphics.FromImage((Image)bitmap2);
int y = row * 32;
Rectangle srcRect2 = new Rectangle(col * 32, y, 32, 32);
graphics2.DrawImage(image2, 0, 0, srcRect2, GraphicsUnit.Pixel);
graphics2.Dispose();
return bitmap2;
}
public string ItemNameFast(int itemID)
{
if (itemID == -1)
return "";
ticon ticon = IconList.List.Find((Predicate<ticon>)(p => p.ItemID.Equals(itemID)));
if (ticon == null)
return "";
return ticon.Name;
}
public string ItemDescrFast(int itemID) //dethunter12 item description fast implement
{
if (itemID == -1)
return "None";
ticon ticon = IconList.List.Find((Predicate<ticon>)(p => p.ItemID.Equals(itemID)));
if (ticon == null)
return "None";
return ticon.Desc;
}
public string DrawBoxNameFromItem(int itemID) //dethunter12 draw box name from icon
{
if (itemID == -1)
return "None";
ticon ticon = IconList.List.Find((Predicate<ticon>)(p => p.ItemID.Equals(itemID)));
if (ticon == null)
return "None";
int num1 = 0;
string str = " select a_num_0 from t_item WHERE a_type_idx = 2 AND a_sub_type_idx = 9 AND ENABLE = 1 AND a_index = '" + itemID + "';";
MySqlConnection mySqlConnection = new MySqlConnection("datasource=" + Host + ";port=3306;username=" + User + ";password=" + Password + ";database=" + Database);
MySqlCommand command = mySqlConnection.CreateCommand();
command.CommandText = str;
mySqlConnection.Open();
MySqlDataReader mySqlDataReader = command.ExecuteReader();
while (mySqlDataReader.Read())
{
num1 = Convert.ToInt32(mySqlDataReader.GetValue(0));
ticon.num0 = num1;
}
mySqlConnection.Close();
if (itemID == 1838 || itemID == 1839 || itemID == 2135
|| itemID == 2136 || itemID == 2146 || itemID == 2148
|| itemID == 2407 || itemID == 2408 || itemID == 2500 || itemID == 2609 || itemID == 2666
|| itemID == 2710 || itemID == 2711 || itemID == 2712 || itemID == 2713 || itemID == 2714 || itemID == 2859 || itemID == 2860 || itemID == 2861 || itemID == 2862 || itemID == 2863
|| itemID == 2864 || itemID == 2882 || itemID == 2982 || itemID == 3575 || itemID == 3764 || itemID == 3769 || itemID == 4709 || itemID == 4911
|| itemID == 5018 || itemID == 5019 || itemID == 5067 || itemID == 5123 || itemID == 5124 || itemID == 5329 || itemID == 5347 || itemID == 5952 || itemID == 6251
|| itemID == 6256 || itemID == 6258 || itemID == 6259 || itemID == 6260 || itemID == 6593 || itemID == 6647 || itemID == 6648 || itemID == 6653 || itemID == 6697 || itemID == 6804
|| itemID == 6890 || itemID == 6891 || itemID == 7064 || itemID == 7210 || itemID == 7307 || itemID == 7308 || itemID == 7310
|| itemID == 7311 || itemID == 7320 || itemID == 7321 || itemID == 7336 || itemID == 7337 || itemID == 7394 || itemID == 7484
|| itemID == 7572 || itemID == 7573 || itemID == 7574 || itemID == 7575 || itemID == 7576 || itemID == 7577 || itemID == 7578 || itemID == 7579 || itemID == 7580 || itemID == 7612 || itemID == 7619 || itemID == 7620 || itemID == 7622 || itemID == 7623 || itemID == 7624
|| itemID == 7736 || itemID == 7898 || itemID == 9938 || itemID == 10022 || itemID == 10266 || itemID == 10286 || itemID == 10301 || itemID == 10799 || itemID == 11038)
return "None";
return ticon.Name;
}
public string MobNameFast(int MobIndex) //dethunter12 add 6/14/2018
{
if (MobIndex == -1)
return "None";
tNpc Tnpc = NpcList.List.Find((Predicate<tNpc>)(p => p.ItemID.Equals(MobIndex)));
if (Tnpc == null)
return "None";
return Tnpc.Name;
}
public string SkillNameFast(int SkillIndex) //dethunter12 add 6/14/2018
{
if (SkillIndex == -1)
return "None";
tSkill skill = SkillList.List.Find((Predicate<tSkill>)(p => p.ItemID.Equals(SkillIndex)));
if (skill == null)
return "None";
return skill.Name;
}
public Bitmap Icon(int ItemID)
{
int num1 = 0;
int num2 = 0;
int num3 = 0;
string str = " select a_texture_id, a_texture_row, a_texture_col from t_item WHERE a_index ='" + ItemID + "';";
MySqlConnection mySqlConnection = new MySqlConnection("datasource=" + Host + ";port=3306;username=" + User + ";password=" + Password + ";database=" + Database);
MySqlCommand command = mySqlConnection.CreateCommand();
command.CommandText = str;
mySqlConnection.Open();
MySqlDataReader mySqlDataReader = command.ExecuteReader();
while (mySqlDataReader.Read())
{
num1 = Convert.ToInt32(mySqlDataReader.GetValue(0));
num2 = Convert.ToInt32(mySqlDataReader.GetValue(1));
num3 = Convert.ToInt32(mySqlDataReader.GetValue(2));
}
Image image = Image.FromFile("icons/ItemBtn" + num1.ToString() + ".png");
Bitmap bitmap = new Bitmap(32, 32);
Graphics graphics = Graphics.FromImage((Image) bitmap);
int y = num2 * 32;
Rectangle srcRect = new Rectangle(num3 * 32, y, 32, 32);
graphics.DrawImage(image, 0, 0, srcRect, GraphicsUnit.Pixel);
graphics.Dispose();
mySqlConnection.Close();
return bitmap;
}
public Bitmap IconItem(int FileID, int Row, int Col)
{
Image image = Image.FromFile("icons/ItemBtn" + FileID.ToString() + ".png");
Bitmap bitmap = new Bitmap(32, 32);
Graphics graphics = Graphics.FromImage((Image) bitmap);
int y = Row * 32;
Rectangle srcRect = new Rectangle(Col * 32, y, 32, 32);
graphics.DrawImage(image, 0, 0, srcRect, GraphicsUnit.Pixel);
graphics.Dispose();
return bitmap;
}
public Bitmap IconSkill1(int FileID, int Row, int Col)
{
Image image = Image.FromFile("icons/SkillBtn" + FileID.ToString() + ".png");
Bitmap bitmap = new Bitmap(32, 32);
Graphics graphics = Graphics.FromImage((Image) bitmap);
int y = Row * 32;
Rectangle srcRect = new Rectangle(Col * 32, y, 32, 32);
graphics.DrawImage(image, 0, 0, srcRect, GraphicsUnit.Pixel);
graphics.Dispose();
return bitmap;
}
public Bitmap IconActionn(int FileID, int Row, int Col)
{
Image image = Image.FromFile("icons/ActionBtn" + FileID.ToString() + ".png");
Bitmap bitmap = new Bitmap(32, 32);
Graphics graphics = Graphics.FromImage((Image)bitmap);
int y = Row * 32;
Rectangle srcRect = new Rectangle(Col * 32, y, 32, 32);
graphics.DrawImage(image, 0, 0, srcRect, GraphicsUnit.Pixel);
graphics.Dispose();
return bitmap;
}
public Bitmap IconItemCollection(int FileID, int Row, int Col)
{
Image image = Image.FromFile("icons/ItemCollectionBtn" + FileID.ToString() + ".png");
Bitmap bitmap = new Bitmap(60, 60);
Graphics graphics = Graphics.FromImage((Image) bitmap);
int y = Row * 60;
Rectangle srcRect = new Rectangle(Col * 60, y, 60, 60);
graphics.DrawImage(image, 0, 0, srcRect, GraphicsUnit.Pixel);
graphics.Dispose();
return bitmap;
}
public string FunctionItemName(int itemID)
{
string str1 = " select a_name from t_item WHERE a_index ='" + itemID + "';";
MySqlConnection mySqlConnection = new MySqlConnection("datasource=" + Host + ";port=3306;username=" + User + ";password=" + Password + ";database=" + Database);
MySqlCommand command = mySqlConnection.CreateCommand();
command.CommandText = str1;
mySqlConnection.Open();
MySqlDataReader mySqlDataReader = command.ExecuteReader();
string str2 = "";
while (mySqlDataReader.Read())
str2 = mySqlDataReader.GetValue(0).ToString();
mySqlConnection.Close();
return str2;
}
public string FunctionMonsterName(int MonsterID)
{
string str1 = "select a_name from t_npc WHERE a_index ='" + MonsterID + "';";
MySqlConnection mySqlConnection = new MySqlConnection("datasource=" + Host + ";port=3306;username=" + User + ";password=" + Password + ";database=" + Database);
MySqlCommand command = mySqlConnection.CreateCommand();
command.CommandText = str1;
mySqlConnection.Open();
MySqlDataReader mySqlDataReader = command.ExecuteReader();
string str2 = "";
while (mySqlDataReader.Read())
str2 = mySqlDataReader.GetValue(0).ToString();
mySqlConnection.Close();
return str2;
}
public string FunctionQuestName(int QuestID)
{
string str1 = " select a_name from t_quest WHERE a_index ='" + QuestID + "';";
MySqlConnection mySqlConnection = new MySqlConnection("datasource=" + Host + ";port=3306;username=" + User + ";password=" + Password + ";database=" + Database);
MySqlCommand command = mySqlConnection.CreateCommand();
command.CommandText = str1;
mySqlConnection.Open();
MySqlDataReader mySqlDataReader = command.ExecuteReader();
string str2 = "";
while (mySqlDataReader.Read())
str2 = mySqlDataReader.GetValue(0).ToString();
mySqlConnection.Close();
return str2;
}
}
}