0
How to create a database table in 15*15. But it is not necessary to be 15*15
table
3 ответов
+ 1
Sorry I went of the radar for sometime. Hope this answer is still valuable for you.
The funny thing is when you create a table in c#, it is easy to add columns and or rows. So it does not need to be fixed 15 by 15.
The big question is what do you want to do with it ?
Do you need a database-file where data is stored or do you need a dynamic table which is filled during run-time by your program ?
https://www.dotnetperls.com/datatable
I'll just start with a table in c#
DataTable table = new DataTable();
//Add a columns
table.Columns.Add("Dosage", typeof(int));
table.Columns.Add("Drug", typeof(string));
table.Columns.Add("Patient", typeof(string));
table.Columns.Add("Date", typeof(DateTime));
//here there are 4 columns but i could be 15
Add rows
table.Rows.Add(25, "Indocin", "David", DateTime.Now);
//this is one but it can be inifinit (almost)
//define the number of columns before you start adding rows, so you know which data is need to fill the cells
//and a foreach loop to view the data in the table
foreach (DataRow row in data.Rows)
{
// ... Write value of first field as integer.
Console.WriteLine(row.Field<int>(0));
}
+ 2
15 rows and 15 columns
0
Explai yourself a bit more. What does 15*15 mean ?