Football Rating Program Using DataTable and DataRow Objects in C# Dot Net

The initial step is to import information from a csv document (comma delimited text record) and burden it memory of my program so I can every now and again access it without opening an outside document each time.

I will likewise have to run questions on this information to perform searches and estimations. The item DataTable in ADO.net suits this reason.

Whenever I have made my table I need to characterize the sections I need and the properties of these segments. The outcomes document is in the accompanying arrangement

Host group, Away group, home objectives, away objectives

teamA , Team B, 1, 0

teamD , Team C, 4, 0

teamF , Team E, 1, 1

I will call my table importResultsTable

DataTable importResultsTable = new DataTable(“imported”);

Also, characterize every one of the segments I need in my table and add it to the table characterized previously.

First make a section to be added to the table คาสิโนเครดิตฟรี100

DataColumn fht = new DataColumn();

Next pick what kind of information the segment stores, for a group name it will be a string

fht.DataType = System.Type.GetType(“System.String”);

Next pick what the section going to show up in the table

fht.ColumnName = “homeTeam”;

lastly add it to our table

importResultsTable.Columns.Add(fht);

This code is rehashed for every section that is added to our table

DataColumn fat = new DataColumn();

at.DataType = System.Type.GetType(“System.String”);

at.ColumnName = “awayTeam”;

importResultsTable.Columns.Add(fat);

The following two sections are for the objectives scored by each team,these are number sorts.

DataColumn hg = new DataColumn();

hg.DataType = System.Type.GetType(“System.Int32”);

hg.ColumnName = “homeGoals”;

importResultsTable.Columns.Add(hg);

DataColumn ag = new DataColumn();

ag.DataType = System.Type.GetType(“System.Int32”);

ag.ColumnName = “awayGoals”;

importResultsTable.Columns.Add(ag);

We would now be able to utilize our DataTable to peruse in the information from our outcomes document.

Leave a Reply