Problem with SQL or DataTable.

TeraByte

New member
Joined
Jan 8, 2007
Messages
4
Programming Experience
Beginner
I am trying to get all instances of a player in a game, showing maps they have played, other names they have used with an SQL query, and pass results to a datatable, to see other names being used, count the times and get most played maps and least played maps.


The SQL query executes without error but when it tries to insert it into the datatable it errors out with. I even stepped throught the debugger and it doesn't look like it was returning any results.

System.ArgumentException: Column 'TNameCount' does not belong to table .
at System.Data.DataRow.GetDataColumn(String columnName)
at System.Data.DataRow.get_Item(String columnName)

Also the fields in the datatable are different then in the database and was wondering if that was causing the issue.

Here is my query...


Dim strSQL AsString = "SELECT PlayerName, Map, COUNT(PlayerName) AS TNameCount, COUNT(Map) AS TMapCount FROM tblAlias WHERE sGUID = " & "'" & myGUID & "'" & " GROUP BY PlayerName, Map"

Also, I am using a reader and not using a dataadapter or anything that has support for table mappings and trying to loop through the records and add the row to the datatable.

Any ideas or new ideas would be much appreciated.
 
just tell me.. how do you expect visual studio to artificially intelligently figure out what columns to update to what, when you attempt to have it create an update query based on a grouped, counted query?
 
Well, it all worked out for me. But to me if I'm telling it this is that with a reader object as it reads in that should work. Since it's unbound why does it have to now?
 
Back
Top