本文介绍了C#的新手 - 数据库问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我习惯使用旧学校的ADO,在那里我可以创建像:


objConn.Open(sConnectString);


objRecordSet 。打开(从用户中选择*,其中UID =''+ sUserID +"''",

objConn);


然后我有一个记录集集合,我可以根据特定的SQL查询过滤或逐步完成

等。


.NET中是否采用了类似的方法?我看到的项目如


DataSource

TableAdapter

DataSet


但是我这样做没有看到针对特定的

表或一组表执行SQL的特定方法。我将我的数据源定义到我的项目

我可以将网格或字段视图拖放到我的表单中,但我没有

想要这种类型的功能。我想要用户输入,然后在我的数据库中执行

查询。


有人能指出我正确的方向吗?


提前致谢!

I am used to using old school ADO where I might create things like:

objConn.Open( sConnectString);

objRecordSet.Open ("Select * from users where UID='' + sUserID + "''",
objConn);

Then I have a recordset collection that I can filter on or step through
etc. based on a specific SQL query.

Is there a similar methodology employed in .NET? I see items like

DataSource
TableAdapter
DataSet

But I do not see a specific method for executing SQL against a specific
table or set of tables. I have my data source defined to my project
and I can drag and drop grid or field views to my form but I do not
want that type of functionality. I want user inputs that I then do a
lookup in my database with.

Can someone point me in the right direction?

Thanks in advance!

推荐答案




这篇关于C#的新手 - 数据库问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 15:26
查看更多