Hangman game in asp.net / c# -
i trying create hangman game in asp .net using c#, since beginner in field, got stuck.
this have done far:
public static string getrandomwords() { string query = string.format("select top 1 word, description hangman order newid()"); stringbuilder result = new stringbuilder(); try { conn.open(); command.commandtext = query; sqldatareader reader = command.executereader(); while (reader.read()) { result.append(reader["word"].tostring()); result.append(reader["description"].tostring()); } reader.close(); } { conn.close(); } return result.tostring(); }
now gives me 1 string looks this: elephanthugeanimal. have idea how can separate 2 textboxes? elephant in first one, , description in other?
result.appendformat(@"{0} | {1}", reader["word"], reader["description"]);
just suggestion, might want use using statement every object implements idisposable
Comments
Post a Comment