从ADODB(RECORDSET)迁移到VB.NET [英] Migrating from ADODB(RECORDSET) to VB.NET

查看:97
本文介绍了从ADODB(RECORDSET)迁移到VB.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想在我使用ADODB之前询问我的vb.NET项目中的问题(根据我过去在vb6上的经验)。



我只是在vb.NET上使用SQLClient命名空间,并发现它可以正常工作或完全符合我的项目。



我的问题是这个,



有什么办法或代码使用SQL命令属性或任何东西,它们的功能是一样的作为我之前使用ADODB(Recordset / rs)的项目中的rs.EOF?是否还有一个SQLCommand属性与recordset的.EOF属性相同?



感谢谁可以帮助我。



我尝试过:



Hi, I just want to ask about my problem in my vb.NET project since I was before using ADODB(from my past experience on vb6).

I'm just NEW on using SQLClient namespace on vb.NET and find out that it works or fits on my project perfectly.

My question is this,

"Is there any way or a code using SQL command property or anything, that will function just the same as "rs.EOF" from my previous project that was using ADODB(Recordset/rs)? Is there also a property of SQLCommand that will functioned the same as ".EOF" property of recordset?"

Thanks for who might help me.

What I have tried:

If Not rs.EOF Then
  If Not rs = DBNull.Value Then
  'DateReceived = rs![Date]
   xlApp.Sheets("Sheet1").Cells(RPos, "D").NumberFormat = "mm/dd/yy"
   xlApp.Sheets("Sheet1").Cells(RPos, "D").Value = DateReceived
  End If
End If



~rs代码来自我之前使用adodb命名空间的项目,我现在使用sqlclient命名空间,所以我需要转换这些代码用于我的新命名空间。


~ rs codes were from my previous project that was using adodb namespace, I'm now using sqlclient namespace so I need to convert these codes to work for my new namespace.

推荐答案

这里在VB.NET中从数据库中获取记录你可以使用DataReader或Dataset,你可以使用ADO。 .NET DataReader检索一个来自数据库的只读,仅向前数据流

见下面的MSDN链接

使用DataReader检索数据 [ ^ ]
Here in VB.NET to fetch record from database you can use either use DataReader or Dataset, You can use the ADO.NET DataReader to retrieve a read-only, forward-only stream of data from a database
see below MSDN links for it
Retrieving Data Using a DataReader[^]


这篇关于从ADODB(RECORDSET)迁移到VB.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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