在我的C#项目中,我需要在代码中创建一个数据库,其中一个表具有动态列号.像这样
------------------------------------------------------------------------------
| Time ¦ Element #1 | Element#2 ¦ ... ¦ Element#N ¦
------------------------------------------------------------------------------
¦ TimeValue#1 ¦ Element#1Value#1 ¦ Element#2Value#1 ¦ ... ¦ Element#NValue#1 ¦
¦ TimeValue#2 ¦ Element#1Value#2 ¦ Element#2Value#2 ¦ ... ¦ Element#NValue#2 ¦
...
¦ TimeValue#M ¦ Element#1Value#M ¦ Element#2Value#M ¦ ... ¦ Element#NValue#M ¦
------------------------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)
我使用简单的SQL查询'SQL CREATE TABLE'
public void AddTable(string TableName, Dictionary<string,Type> columns)
{
...
string query = @"CREATE TABLE " + TableName + "(";
foreach (var c in columns)
{
SqlParameter temp = …Run Code Online (Sandbox Code Playgroud)