Click here to Skip to main content
15,912,400 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionplz answer urgently.......Pop-up window in ASP.NET Pin
Mairy28-Jul-06 13:20
Mairy28-Jul-06 13:20 
AnswerRe: plz answer urgently.......Pop-up window in ASP.NET Pin
thomas_joyee28-Jul-06 17:45
thomas_joyee28-Jul-06 17:45 
AnswerRe: plz answer urgently.......Pop-up window in ASP.NET Pin
Guffa28-Jul-06 22:25
Guffa28-Jul-06 22:25 
QuestionJavascript does not work on asp.net 2 page Pin
Rookie28-Jul-06 12:19
Rookie28-Jul-06 12:19 
AnswerRe: Javascript does not work on asp.net 2 page Pin
Guffa28-Jul-06 12:50
Guffa28-Jul-06 12:50 
GeneralRe: Javascript does not work on asp.net 2 page Pin
Rookie28-Jul-06 13:17
Rookie28-Jul-06 13:17 
GeneralRe: Javascript does not work on asp.net 2 page Pin
Guffa28-Jul-06 22:10
Guffa28-Jul-06 22:10 
QuestionGeneric query database and sort out returned DataSet? Pin
toptone7828-Jul-06 9:43
toptone7828-Jul-06 9:43 
This could probably also be in the SQL forum but nevermind.

What i am trying to do is create a generic class for storing my query results. At the moment i have a Database class that i can call an queryDatabase(string queryString) method that i call with SELECT statements. This returns a dataset populated with the query results.

Then in each of my classes such as Player, Item etc (making a web game here) i would do something such as:

Database db = new Database();
DataSet playerResultSet = db.queryDatabase("SELECT name FROM Player WHERE id = " + id);
if (playerResultSet.Tables.Count > 0)
{
DataTable playerTable = playerResultSet.Tables[0];
if (playerTable.Rows.Count > 0)
name = (string)playerTable.Rows[0]["name"];
}

This would give me the name of the playerID that i searched for.

What i am looking to do is to remove the code that i pasted to a separate, generic, class so that my classes such as Player and Item don't have to use DataSets, DataTables etc. I'm wondering if this is possible really since it will have to be generic, which creates problems since i wont know which table has been searched or the rows/columns in it and also the number of results.

So ideally this generic class would have methods to get the number and names of tables/rows or whatever and the values in them.

Has anyone ever had this problem / created a similar class / knows what i'm talking about?

Thanks for the help.
Tony.
AnswerRe: Generic query database and sort out returned DataSet? Pin
Ista28-Jul-06 9:57
Ista28-Jul-06 9:57 
GeneralRe: Generic query database and sort out returned DataSet? Pin
toptone7828-Jul-06 11:31
toptone7828-Jul-06 11:31 
GeneralRe: Generic query database and sort out returned DataSet? Pin
Ista28-Jul-06 18:41
Ista28-Jul-06 18:41 
GeneralRe: Generic query database and sort out returned DataSet? Pin
toptone7829-Jul-06 5:22
toptone7829-Jul-06 5:22 
GeneralRe: Generic query database and sort out returned DataSet? Pin
Ista29-Jul-06 7:11
Ista29-Jul-06 7:11 
GeneralRe: Generic query database and sort out returned DataSet? Pin
Ista29-Jul-06 7:24
Ista29-Jul-06 7:24 
GeneralRe: Generic query database and sort out returned DataSet? Pin
toptone7829-Jul-06 8:50
toptone7829-Jul-06 8:50 
GeneralRe: Generic query database and sort out returned DataSet? Pin
toptone7829-Jul-06 12:11
toptone7829-Jul-06 12:11 
GeneralRe: Generic query database and sort out returned DataSet? Pin
Ista29-Jul-06 15:41
Ista29-Jul-06 15:41 
GeneralRe: Generic query database and sort out returned DataSet? Pin
toptone7830-Jul-06 0:25
toptone7830-Jul-06 0:25 
GeneralRe: Generic query database and sort out returned DataSet? [modified] Pin
Ista31-Jul-06 4:48
Ista31-Jul-06 4:48 
GeneralRe: Generic query database and sort out returned DataSet? Pin
toptone781-Aug-06 4:53
toptone781-Aug-06 4:53 
QuestionWant no postback on imagebutton click Pin
Vijaykumar Rajaram28-Jul-06 7:34
Vijaykumar Rajaram28-Jul-06 7:34 
AnswerRe: Want no postback on imagebutton click Pin
Ista28-Jul-06 8:44
Ista28-Jul-06 8:44 
AnswerRe: Want no postback on imagebutton click Pin
eggsovereasy28-Jul-06 8:51
eggsovereasy28-Jul-06 8:51 
QuestionAccess denied - urgent Pin
dansoft28-Jul-06 6:58
dansoft28-Jul-06 6:58 
AnswerRe: Access denied - urgent Pin
ToddHileHoffer28-Jul-06 7:03
ToddHileHoffer28-Jul-06 7:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.