473,378 Members | 1,351 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Issue with DAO to ADO.Net

LDD
Hey folks

I'm porting an app from VB6 to VB.Net... what a process!

I'm about 70% of the way through.

However I'm trying to find some information on how to upgrade the code
snippet below to make use of ADO.Net

-----------------------------------------------------
....
Dim prsFiles As DAO.Recordset

prsFiles = frmMain.DefInstance.getDatabase.OpenRecordset("tab leName",
DAO.RecordsetTypeEnum.dbOpenDynaset)

End Select

prsFiles.AddNew()

prsFiles.Fields("FileName").Value = vsfilename

prsFiles.Update()

prsFiles.Close()

-----------------------------------------------------
The subroutine gets called from within a loop.

How do I modify the code to use ado.net/
Or if there is any clear documentation with samples, that would be cool to..

thanks

LDD

Nov 21 '05 #1
3 1663
LDD,

In my opinon the only answer can be in my opinion. Buy a book about ADONET.

Very known in these newsgroups are Sceppa and Vaughn as they are active in
these newsgroups.

microsoft.public.dotnet.framework.ADONET

Your question is to general and needs to much extra information for a
newsgroup message.

Sorry

Cor

"LDD" <la***************@gmail.com> schreef in bericht
news:7u********************@magma.ca...
Hey folks

I'm porting an app from VB6 to VB.Net... what a process!

I'm about 70% of the way through.

However I'm trying to find some information on how to upgrade the code
snippet below to make use of ADO.Net

-----------------------------------------------------
...
Dim prsFiles As DAO.Recordset

prsFiles = frmMain.DefInstance.getDatabase.OpenRecordset("tab leName",
DAO.RecordsetTypeEnum.dbOpenDynaset)

End Select

prsFiles.AddNew()

prsFiles.Fields("FileName").Value = vsfilename

prsFiles.Update()

prsFiles.Close()

-----------------------------------------------------
The subroutine gets called from within a loop.

How do I modify the code to use ado.net/
Or if there is any clear documentation with samples, that would be cool
to..

thanks

LDD

Nov 21 '05 #2
If you only have a very small amount of code to port and it doesn't use
databinding then you can use "classic" ADO from VB.NET - just add a
reference to ADODB.dll and start using the objects. You might also be
able to use DAO via COM interrop - but ADO is pretty similar in usage
to DAO.

If you have a large amount of this type of code to port and your
project uses a lot of databinding then you might want to consider
Infralution's Virtual Data Objects. This allows you to use classic
ADODB with ADO.NET databinding and can take a lot of the pain out of
porting a large application. You can download a fully functional
evaluation version at:

www.infralution.com/virtualdata.html

Grant Frisken
Infralution

Nov 21 '05 #3
Here's part of your conversion. This is an application that was in VB6 using
DAO which I've converted to VB.NET using ADO. The app uses the data from the
table to fill in a grid for viewing purposes.

Original DAO code:

Dim dbSteel As Database
Dim rsAK As DAO.Recordset
Set dbSteel = OpenDatabase("AKSteelEpstienValues.mdb")
Sql = "Select * from AKSteelData order by coil"
rsAK = dbSteel.OpenRecordset(Sql, DAO.RecordsetTypeEnum.dbOpenDynaset)

Coverted ADO code:

Dim sql As String
Dim da As OleDbDataAdapter
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim Roll As DataSet
Me.MdiParent = CoreInfo.MDIForm1.ActiveForm
Cursor.Current = Cursors.WaitCursor
sql = "Select * from AKSteelData order by coil"
con = New OleDbConnection(OptAKCnn)
cmd = New OleDbCommand
da = New OleDbDataAdapter
cmd.Connection = con
cmd.CommandText = sql
cmd.CommandType = CommandType.Text
con.Open()
Roll = New DataSet
da.SelectCommand = cmd
da.Fill(Roll, "AKSteelData")
DataGrid1.DataSource = Roll.Tables("AKSteelData")
con.Close()
con.Dispose()
Cursor.Current = Cursors.Default


"LDD" wrote:
Hey folks

I'm porting an app from VB6 to VB.Net... what a process!

I'm about 70% of the way through.

However I'm trying to find some information on how to upgrade the code
snippet below to make use of ADO.Net

-----------------------------------------------------
....
Dim prsFiles As DAO.Recordset

prsFiles = frmMain.DefInstance.getDatabase.OpenRecordset("tab leName",
DAO.RecordsetTypeEnum.dbOpenDynaset)

End Select

prsFiles.AddNew()

prsFiles.Fields("FileName").Value = vsfilename

prsFiles.Update()

prsFiles.Close()

-----------------------------------------------------
The subroutine gets called from within a loop.

How do I modify the code to use ado.net/
Or if there is any clear documentation with samples, that would be cool to..

thanks

LDD

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Paul Mateer | last post by:
Hi, I have been running some queries against a table in a my database and have noted an odd (at least it seems odd to me) performance issue. The table has approximately 5 million rows and...
7
by: George Hester | last post by:
Please take a look at this google artcle: http://groups.google.com/groups?hl=en&lr=&frame=right&th=55d6f4b50f5f9382&seekm=411f370d%241%40olaf.komtel.net#link9 The op was having trouble with...
2
by: Anthony Cuttitta Jr. | last post by:
We have an application that outputs several different graphs from data downloaded from our AS400. The application has worked without (this) issue for several months now, but just recently, the...
0
by: Kevin Spencer | last post by:
Hi all, I am working on a service that uploads METAR weather information to the National Weather Service FTP site. The service I'm authoring is hosted on a Windows 200 server, and the NWS FTP...
2
by: Ben Rush | last post by:
Hello World, Okay, I have spent the day browsing the newsgroups and reading up on article after article concerning ViewState corruption and so forth, and I have a couple questions. We...
5
by: Robert | last post by:
I have a series of web applications (configured as separate applications) on a server. There is a main application at the root and then several virtual directories that are independant...
0
by: Charles Leonard | last post by:
I am having yet another issue with Windows Server 2003. This time, the web service (a file import web service) appears to run except for one odd message: "ActiveX component can't create object". ...
4
by: Paul | last post by:
Hi, I've been struggling with this today, I'm developing a DotNet2.0 website in C# that needs to call a long running data query. Obviously this is a good candidate for an Asynchronous call, so...
1
by: AlekseyUS | last post by:
Hi, I'm a little stuck, I basically need to copy all the information within a specific file in Temp and append it to a file in another location. I'm not having any problems with smaller size...
13
by: SAL | last post by:
Hello, I'm trying to include a popup in the ItemTemplate of a gridview row. The ItemTemplate for the field contains a textbox and when the user clicks in the textbox I want a popup panel to show...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.