I'm making a map editor using C# for my online RPG game. Basically I have two loops which run through the x and y coordinates and get the values for each x,y coordinate. Some of the x,y coordinates in the various tables are empty because they relate to the base tiles for the map. For example, a world map would have a base tile of grass. Therefore in any world map table any tile which would have grass is empty.
My first problem is I am trying to figure out is how to check in C# whether the row is present or empty. I'm using this as my mysql query:
OdbcComm = new System.Data.Odbc.OdbcCommand("SELECT * FROM "+maptable.SelectedItem.ToString()+" WHERE xvalue='"+y+"' AND yvalue='"+x+"';", OdbcCon);
OdbcDRm = OdbcComm.ExecuteReader();
Then I have
while (OdbcDRm.Read()) {
CODE HERE}
The second problem is, if an image tile isn't found (does not exist), I keep getting an error. I want to somehow make it so that if the tile does not exist at the current moment, that the image would be replaced with the default image does not exist image. I'm using this to get the image:
Image tile = Image.FromFile(tileimg+".bmp");
The third problem I am forseeing is I figure out a way to make each tile clickable, so that I can click the tile and it sends some data to a form element (input boxes, etc).