如何通过在C#中引用DataTable动态地在DB中创建表

如何通过在C#中引用DataTable动态地在DB中创建表

本文介绍了如何通过在C#中引用DataTable动态地在DB中创建表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我有一个特定的要求是这样的, 会有在我的C#应用​​程序中的DataTable,其结构是动态的。我希望将相同的结构存储到DB中。 对于Ex:我有一个带有名称测试的DataTable,TestID和TestValue是两个DataColumns。 我想在DB中创建一个Table作为Test,并且列TestID和TestValue也会从数据表中复制数据。 因此,每当我获得数据表时,都应在数据库中创建一个新表。 此要求可以通过C#代码本身或甚至使用存储过程来完成在SQL Server中。 请帮助我。 谢谢和问候, Mathi。解决方案 Hi,I have a specific requirement which goes like this,There will be a DataTable in my C# application the structure of that is dynamic. I wanted that to be stored with the same structure into DB.For Ex: I have a DataTable with Name Test and TestID and TestValue are two DataColumns in it.I wanted in DB to create a Table as Test and with columns TestID and TestValue also copy the data as well from the data table.So whenever I get a data Table a new table should be created in the DB.This requirement can be done either through C# code itself or even using a stored procedure in SQL Server.Please help me in this.Thanks & Regards,Mathi. 解决方案 这篇关于如何通过在C#中引用DataTable动态地在DB中创建表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-23 23:13