ADO.NET的困惑,放分(清仓,甩卖,大放血)

pl281635581 2006-10-29 04:50:02
小弟刚学C#,看了一些ADO.NET的东西,还感觉不太清楚。
问题一:
方法一:我先用一个DataGridView控件,然后点击控件上方的小三角,提示我添加
项目数据源,然后我就一步一步的往下走,完成后会自动生成三个控件:DataSet,
BindingSource和TableAdapter,数据也能过来。

方法二:如果我自己脱过来一个SqlDataAdapter,然后连接数据库,会生成一个SqlConnection,
通过SqlDataAdapter我可以创建数据集DataSet,数据也可以正常过来,并且可以和
DataGridView相关连。

不知道这两种方法有何区别,那种更好,或者还有其他更好的方法。

问题二:
另外DataGridView与DataGrid有何区别,那个更好,或者还有其他类似得控件。

问题三:
如果做数据库方面的东西,哪几个控件比较好,比较常用。

只要说到点上就有分,多多益善。
...全文
252 11 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
mengfanzhang 2007-02-06
  • 打赏
  • 举报
回复
做好一件事情当然有很多方法,选择一条你最顺手的就可以了。
zorro911 2006-10-30
  • 打赏
  • 举报
回复
方法一我没有用过,我都用方法二,感觉不错,你只要用的舒服就好
DataGridView多和TreeView一起用做一个像资源管理器一样的东西,DataGrid多是单纯显示数据
刚开始做程序不要一味追求控件,多用代码写一写,我做数据库操作从不用控件,都用代码写
破碎的脸 2006-10-30
  • 打赏
  • 举报
回复
看你自己了。。。我一般在没必要写的时候就一个字“拖”!
pshy 2006-10-30
  • 打赏
  • 举报
回复
頂,jf.......
marvelstack 2006-10-30
  • 打赏
  • 举报
回复
建议楼主先看一本讲ado.net的书,比如<ado.net技术内幕> ,
对DbConnection.DbCommand,DbDataRead,DbDataAdapter,
DataSet,DataTable,DataView,DataRow,DataColumn,DataRelation等对象的关系和作用熟悉之后。就明了了。
也可以通过代码来具体的实践。
http://blog.csdn.net/zhzuo/archive/2004/08/06/67016.aspx
http://blog.csdn.net/zhzuo/archive/2004/08/06/67037.aspx
wisdomhxz 2006-10-29
  • 打赏
  • 举报
回复
两种都不好用.如果你用的是vs05,建议你用建立数据集的方法,用dateset建立强类型的数据集合
brbrm 2006-10-29
  • 打赏
  • 举报
回复
如果熟练的话,可既不使用DataSet, BindingSource和TableAdapter,也不拖放任何控件,而在代码中创建变量,能够达到最好的性能:
SqlConnection con1 = new System.Data.SqlClient.SqlConnection();
con1.ConnectionString = "Provider=SQLOLEDB.1; Data Source=MySQLServer; Initial Catalog=NORTHWIND; Integrated Security=SSPI";
SqlDataAdapter da1 = new SqlDataAdapter(con1, "SELECT CustomerName FROM dbo.Orders");
DataSet ds1 = new DataSet();
con1.Open();
da1.Fill(ds1);
dataGridView.DataSource = ds1;

此外,DataGridView比DataGrid在性能上也有优势

pfworld 2006-10-29
  • 打赏
  • 举报
回复
还是你自己用起来方便用什么!!
DataGridView要比DataGrid好用多了!!
Janyue 2006-10-29
  • 打赏
  • 举报
回复
你选择你需要的
你需要的就是最好的!
jijl2001 2006-10-29
  • 打赏
  • 举报
回复
1,第2种更灵活一点,第一种简单一点,一般第2种
2.DataGridView要好一点
3,没有好的,只有适合一点的
股神 2006-10-29
  • 打赏
  • 举报
回复
up
up
up
《ASP.NET 4权威指南》是ASP.NET领域的又一鸿篇巨制,由资深ASP.NET专家亲自执笔,知名微软技术社区和权威技术专家一致鼎力推荐。 它是国内第一本关于ASP.NET 4的著作。从广度上讲,内容系统而全面,全书一共包含4个部分:第一部分以一个易于实践的示例开篇,既能帮助读者快速了解ASP.NET的开发流程,还能帮助读者建立ASP.NET开发的大局观,紧接着全面介绍了ASP.NET的各种常用控件,这是ASP.NET的基础;第二部分详尽地讲解了ASP.NET访问的所有细节,包括数据管理、数据控件绑定与操作、GridView控件、LINQ查询、LINQ与ADO.NET和XML,以及ADO.NET实体框架等;第三部分深入浅出地讲解了开发一个Web站点必须掌握的各种知识点、流程和方法;第四部分是本书的高级话题,分析了ASP.NET状态管理、自定义服务器控件、ASP.NET缓存、多语言本地化应用程序、ASP.NET Web部件等。从深度上来讲,本书对实际开发中极不常用而大部分同类书都浓墨重彩的知识点只做了必要性的介绍,对于较容易给开发者带来困惑而大部分同类书都浅尝辄止的知识点进行了深入分析,其详细程度是一般同类书不能比拟的。从实践性上讲,本书精心设计了大量可操作性强和极具借鉴价值的实例代码与解决方案。 本书在广度、深度和实践性上完美结合,既能引领初学者快速在实践中掌握ASP.NET开发,又能帮助有一定经验的读者解决在实际开发中遇到的各种疑难问题。
Paperback: 1625 pages Publisher: Apress; 7th ed. 2015 edition (January 1, 2016) Language: English ISBN-10: 1484213335 ISBN-13: 978-1484213339 This new 7th edition of Pro C# 6.0 and the .NET 4.6 Platform has been completely revised and rewritten to reflect the latest changes to the C# language specification and new advances in the .NET Framework. You'll find new chapters covering all the important new features that make .NET 4.6 the most comprehensive release yet, including: A Refined ADO.NET Entity Framework Programming Model Numerous IDE and MVVM Enhancements for WPF Desktop Development Numerous updates to the ASP.NET Web APIs This comes on top of award winning coverage of core C# features, both old and new, that have made the previous editions of this book so popular. Readers will gain a solid foundation of object-oriented development techniques, attributes and reflection, generics and collections as well as numerous advanced topics not found in other texts (such as CIL opcodes and emitting dynamic assemblies). The mission of this book is to provide you with a comprehensive foundation in the C# programming language and the core aspects of the .NET platform plus overviews of technologies built on top of C# and .NET (ADO.NET and Entity Framework, Windows Communication Foundation (WCF), Windows Presentation Foundation (WPF), ASP.NET (WebForms, MVC, WebAPI).). Once you digest the information presented in these chapters, you’ll be in a perfect position to apply this knowledge to your specific programming assignments, and you’ll be well equipped to explore the .NET universe on your own terms. What you’ll learn Be the first to understand the .NET 4.6 platform and C# 6. Discover the ins and outs of the leading .NET technology. Learn from an award-winning author who has been teaching the .NET world since version 1.0. Find complete coverage of XAML, .NET 4.6 and Visual Studio 2015 together with discussion of the new Windows Runtime. Who this book is for This book is perfect for anyone who is interested in the new .NET Framework 4.6 and the C# language. Whether you are moving to .NET for the first time or are already writing applications using previous .NET versions, this book will provide you with a comprehensive grounding in the new technology and serve as a complete reference throughout your coding career.

111,092

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧