Solved

Teach and old Dog new Tricks (Old dumb dog at that)

Posted on 2004-09-13
9
238 Views
Last Modified: 2010-05-02
I have a program that I wrote in vb5 several years ago. It usess an access 97 db and several instances of the datacontrol with bound controlls like datagrids and others.

I would like to convert it to VB6 or even better VB 2005 express, do away with the datacontrols, upgrade to possibly access 2003.

Easy points for the best referance for accomplishing this.  Very detailed explanation with examples would be great, especially on doing away with the datacontrols.

Thanks!
0
Comment
Question by:Gary Dewrell
  • 4
  • 2
  • 2
  • +1
9 Comments
 
LVL 14

Expert Comment

by:Esopo
ID: 12051216
0
 
LVL 2

Expert Comment

by:x50Fade
ID: 12051748
You will need to use ADO to manually connect to your db if you don't want the data controls.

It's quite simple.....

Next about your code...your VB5 code should work nicely in VB6, as VB6 only offers enhancements to VB5, it still uses all the stuff we did in VB5 and just add's to it.

About the DB...Get Newes access, open your old DB, and convert it to the new access format.

This should get you started....

Maybe you could post some more deatiled questions?
0
 
LVL 26

Expert Comment

by:Rejojohny
ID: 12053350
just curious ... what is "VB 2005 express"
0
 
LVL 2

Expert Comment

by:x50Fade
ID: 12053550
Hmmmm....Looks like it's the new VB.NET (Maybe Whidby) "Light Edition"

http://lab.msdn.microsoft.com/express/vbasic/default.aspx
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 12

Author Comment

by:Gary Dewrell
ID: 12060231
That is correct x50! It is a lite version of vb.net.  They also have a sql express, c# express, etc. It is mainly for those who just want to do winforms.

Back to my issue.  Could some one take a moment to explain how to use ADO.

I have several forms accessing several tables from my database.
Im just looking for sorta guide to get started.

Some forms are accessin several tables at the same time. So a quick explanation (not real detailed, I want to figure that out myself, but I need a push) of how to use ado to connect to the database, execute querys that update records, retrieve data for use in datagrids, etc..  

One specific question I have is do I have to write the same code over and over again on each form?
0
 
LVL 2

Accepted Solution

by:
x50Fade earned 500 total points
ID: 12061679
HI Old dog....hehe

K, I can help ya out with ADO, but not ADO.net. VB6 uses ADO and VB.net uses ADO or ADO.NET.

To connect to a DB through ADO, you need mainly two objects.

A Connection Object (Connection to the DB)
A Recordset Object (Used for running queries on tables and retreiving data)

On your last question....The connection you only build once, You can put the data Access Code (Recordset Stuff) in a Module, and use it over and over.

A quick example

Private Sub MDIForm_Load()
    Set dbAse = New Connection
        dbAse.CursorLocation = adUseServer
        dbAse.Open "PROVIDER=MSDataShape;Data PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\systems.mdb"
       
End Sub

In the Module, where RS is defined as a Public Variable

Public Function Open_Recordset(FieldstToOpen As String, TableToOpen As String)

   On Error GoTo Open_Recordset_Error

rs.Open "Select " & FieldstToOpen & " from " & TableToOpen, dbAse, adOpenKeyset, adLockOptimistic

   On Error GoTo 0
   Exit Function

Open_Recordset_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Open_Recordset of Module General" & vbCrLf & vbCrLf & TableToOpen
End Function

Once the recordset is open, you can iterate through it like this...

While not rs.eof
 msgbox rs.fields("Fieldname")
 rs.movenext
Wend

Actually a lot more to it...but this should get you started...
0
 
LVL 2

Expert Comment

by:x50Fade
ID: 12061683
Oh yes and you have to set the propper references in your project....look for Microsoft ActiveX Data Objects and add it as a reference.

Cheers

Fade
0
 
LVL 14

Expert Comment

by:Esopo
ID: 12066259
A thorough explanation on why to take the leap (ADO to ADO.NET) and how to go about it:

Migrating Code and Concepts from ADO "Classic" to ADO.NET

http://msdn.microsoft.com/data/default.aspx?pull=/library/en-us/dnadonet/html/adocnet4.asp

Best regards,

Esopo
0
 
LVL 12

Author Comment

by:Gary Dewrell
ID: 12070288
Thanks guys, I will look trough all of these within the next 24-28 hours and award appoints.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now