Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 253
  • Last Modified:

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

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
Gary Dewrell
Asked:
Gary Dewrell
  • 4
  • 2
  • 2
  • +1
1 Solution
 
x50FadeCommented:
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
 
RejojohnyCommented:
just curious ... what is "VB 2005 express"
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
x50FadeCommented:
Hmmmm....Looks like it's the new VB.NET (Maybe Whidby) "Light Edition"

http://lab.msdn.microsoft.com/express/vbasic/default.aspx
0
 
Gary DewrellSenior Network AdministratorAuthor Commented:
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
 
x50FadeCommented:
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
 
x50FadeCommented:
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
 
EsopoCommented:
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
 
Gary DewrellSenior Network AdministratorAuthor Commented:
Thanks guys, I will look trough all of these within the next 24-28 hours and award appoints.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now