如何将数据从SQL Server数据集中提取到可以使用的类中? [英] How can I extract data from my SQL Server Dataset into a class that I can use?

查看:90
本文介绍了如何将数据从SQL Server数据集中提取到可以使用的类中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试进入几天前开始的项目,我花了整整一天时间在ADO.net上进行阅读,但是我一直在努力了解如何提取SQL Server表数据进入一个类,我基本上可以运行一些计算,例如 startTime-endTime = totalWorked,这将允许我创建一个单独的表单来显示摘要。

I'm trying to make headway into a project that I started on a few days ago, I've spent all day reading up on ADO.net but I'm struggling to understand how I can extract my SQL server table data into a class that I can basically run a few calculations like "startTime - endTime = totalWorked" that will allow me to create a seperate form where I can Display my summaries.

我在这里做了一些小代码,它连接到我的数据库并在代码中创建了一个datagridview。 http://pastebin.com/VNRDqHjM

I have the little code that i've done here, It connects to my database and creates a datagridview in the code. http://pastebin.com/VNRDqHjM

可以

非常感谢,
Ross

Thanks alot, Ross

推荐答案

我强烈建议您检查一些自动为您执行此操作的ORM软件。自己创建类,然后用对象填充它们既费时又容易出错。如今,有可以为您完成所有工作的工具。

I’d strongly suggest you check out some ORM software that does this automatically for you. Creating classes yourself and then filling them up with objects is time consuming and error prone. Nowadays there are tools that do all the work for you.

请查看.NET 此处。我建议那些已经内置到.NET框架中的组件,但是您不会出错。

Check out the list of different options for .NET here. I’d recommend those that are already built in into .NET framework but you can’t go wrong with any of these.

这篇关于如何将数据从SQL Server数据集中提取到可以使用的类中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆