|
-
November 20th, 2011, 03:36 PM
#1
Populating HTMLTables with DataTables using DataSet with DataAdapter.
Hi, and sorry for just bumping in and start asking questions, but I'm in dire need of help!
I've started developing this Data Management System for my guild at AstroEmpires.com but I've run into problems.
First I think I have to tell a little about what kind of data that needs to be managed..
AstroEmpires is a space strategy game where you fly around with a fleet battling other players and build bases (this is not an advertisements) the universe in the game is divided into 3 categories; Galaxies, Regions and Systems (which contains plants & moons)
The game uses a coordinate system to navigate through the universe which looks like this; SGG:RR:SS:AA (E16:14:36:31)
S is the server name, GG, RR, SS and AA is the "i & p" of a grid symbolizing the galaxy/Region/System/Astro.
So first we have the galaxy which contains in each "grid cell" the grid of Regions and Regions contains in each of its cells the System grid which (you guess right) contains in each of its cells planets.
So; ServerName.Galaxy[i,p]:Region[i,p]:System[i,p]:Astro[orbit from sun,orbit from planet]
Galaxy, Region and System cells range from 0,0 to 9,9, Astro cells range from 1,0 to 5,4
These are the coordinates which I have to relate information to. The information I have to relate to the coordinates is; Guild Name, Player Name, Base Defences, Jumpgate level and a short info text.
so the output would look like this:
Code:
Location Guild Player Defence JG Info
E16:14:36:31 [TBAG] Lazy Vulpes 25PR/15PS/10CC 5 My own base
So far I've developed a treemenu where you can add new coordinates to and associate the necessary information to too.
What I'm having trouble with is getting the "collective output" working correct.
-
November 22nd, 2011, 07:56 PM
#2
Re: Populating HTMLTables with DataTables using DataSet with DataAdapter.
Hmm.. Didn't thought this would be accepted by the mods.. I couldn't fit my code inside the first post since I can only use 20k characters so the post is only half way finished..
In any case I have solved my problem by doing this:
Code:
DataColumn tblGuildsNameColum;
DataColumn tblPlayersNameColum;
DataColumn tblDefencesNameColum;
DataColumn tblJumpgatesLevelColum;
DataColumn tblInfoTextColum;
DataColumn tblGuildsParentColum;
DataColumn tblPlayersParentColum;
DataColumn tblDefencesParentColum;
DataColumn tblJumpgatesParentColum;
DataColumn tblInfoParentColum;
DataRelation guildToAstroRelation;
DataRelation playerToAstroRelation;
DataRelation defenceToAstroRelation;
DataRelation jumpgateToAstroRelation;
DataRelation informationToAstroRelation;
tblGalaxyNameColumn = ds.Tables["tbl_galaxies"].Columns["location"];
tblRegionNameColumn = ds.Tables["tbl_regions"].Columns["location"];
tblSystemNameColumn = ds.Tables["tbl_systems"].Columns["location"];
tblAstroNameColumn = ds.Tables["tbl_astros"].Columns["location"];
tblGalaxyParentColumn = ds.Tables["tbl_galaxies"].Columns["parent"];
tblRegionParentColumn = ds.Tables["tbl_regions"].Columns["parent"];
tblSystemParentColumn = ds.Tables["tbl_systems"].Columns["parent"];
tblAstroParentColumn = ds.Tables["tbl_astros"].Columns["parent"];
tblGuildsNameColum = ds.Tables["tbl_guilds"].Columns["name"];
tblPlayersNameColum = ds.Tables["tbl_players"].Columns["name"];
tblDefencesNameColum = ds.Tables["tbl_defences"].Columns["name"];
tblJumpgatesLevelColum = ds.Tables["tbl_jumpgates"].Columns["level"];
tblInfoTextColum = ds.Tables["tbl_informations"].Columns["text"];
tblGuildsParentColum = ds.Tables["tbl_guilds"].Columns["parent"];
tblPlayersParentColum = ds.Tables["tbl_players"].Columns["parent"];
tblDefencesParentColum = ds.Tables["tbl_defences"].Columns["parent"];
tblJumpgatesParentColum = ds.Tables["tbl_jumpgates"].Columns["parent"];
tblInfoParentColum = ds.Tables["tbl_informations"].Columns["parent"];
guildToAstroRelation = new DataRelation("relGuildToAstro", tblAstroNameColumn, tblGuildsParentColum);
playerToAstroRelation = new DataRelation("relPlayerToAstro", tblAstroNameColumn, tblPlayersParentColum);
defenceToAstroRelation = new DataRelation("relDefenceToAstro", tblAstroNameColumn, tblDefencesParentColum);
jumpgateToAstroRelation = new DataRelation("relJumpgateToAstro", tblAstroNameColumn, tblJumpgatesParentColum);
informationToAstroRelation = new DataRelation("relInformationToAstro", tblAstroNameColumn, tblInfoParentColum);
ds.Relations.Add(guildToAstroRelation);
ds.Relations.Add(playerToAstroRelation);
ds.Relations.Add(defenceToAstroRelation);
ds.Relations.Add(jumpgateToAstroRelation);
ds.Relations.Add(informationToAstroRelation);
foreach (DataRow dtrAstros in ds.Tables["tbl_astros"].Rows)
{
label1.InnerHtml += "<tr><td><a href='http://epsilon.astroempires.com/map.aspx?loc=" + dtrAstros["location"] + "' >" + dtrAstros["location"] + "</a></td>";
foreach (DataRow dtrGuilds in dtrAstros.GetChildRows("relGuildToAstro"))
{
label1.InnerHtml +="<td>" + dtrGuilds["name"] + "</td>";
}
foreach (DataRow dtrPlayers in dtrAstros.GetChildRows("relPlayerToAstro"))
{
label1.InnerHtml += "<td>" + dtrPlayers["name"] + "</td>";
}
foreach (DataRow dtrDefences in dtrAstros.GetChildRows("relDefenceToAstro"))
{
label1.InnerHtml += "<td>" + dtrDefences["name"] + "</td>";
}
foreach (DataRow dtrJumpgates in dtrAstros.GetChildRows("relJumpgateToAstro"))
{
label1.InnerHtml += "<td>" + dtrJumpgates["level"] + "</td>";
}
foreach (DataRow dtrInformations in dtrAstros.GetChildRows("relInformationToAstro"))
{
label1.InnerHtml += "<td>" + dtrInformations["text"] + "</td>";
}
label1.InnerHtml += "</tr>";
}
label1.InnerHtml += "</table>";
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|