用于创建类文件的vb.net代码 [英] vb.net code for create a class file
本文介绍了用于创建类文件的vb.net代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在VB.Net中创建一个类文件来包含数据库的所有表及其字段(sql server/ms访问).
请在vb.net中为上述问题提供代码.
How to create a class file for containing all the tables and their fields of database(sql server/ms access) in VB.Net.
pls provide the code for above problem in vb.net.
推荐答案
为什么要这样?您不仅可以将表加载到DataTable对象中,还是可以将实体框架用于SQL Server表?
右键单击您的项目,然后选择[添加->新商品]
在对话框中,选择"ADO.NET实体数据模型",然后输入对象的名称(例如 DatabaseName Entities)
出现空白屏幕,右键单击它,然后选择从数据库生成模型".
祝你好运,
爱德华(Eduard)
Why would you want this? Can you not just load the table in a DataTable object, or use Entity Framework for your SQL Server tables?
Right click your project and choose [ Add -> New Item ]
In the dialog box choose ADO.NET Entity Data Model and enter a name for the object (for example DatabaseNameEntities)
A blank screen appears, right click it and choose ''Generate model from Database''.
Good Luck,
Eduard
如果要在VB.net中生成某种数据库模型,则可以使用ADO.net数据集,Linq To SQL或实体框架.
If you want to generate some sort of model of a database in VB.net you can use ADO.net DataSets, Linq To SQL or Entity Framework.
您含糊不清!
是否要从查询结果中获取列名?如果是这样,这将适用于sql server
从sql服务器查询中获取列名 [ ^ ]
如果我弄错了,您需要扩大您的问题
Your to vague!
do you want to get the column names from the results of a query? If so this will work for sql server
get column names from a sql server query[^]
if I got it wrong you need to expand your question
这篇关于用于创建类文件的vb.net代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文