For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > November 2005 > How to connect VB with Access









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How to connect VB with Access
sheetalsuri11@gmail.com

2005-11-29, 3:55 am

Here i m enclosing my code which i have used for connection this is
basically for DAO (Data Controler) connectivity but in case of
recordsource this gives an error like unrecogonized database
Private Sub Form_Load()
Set con1 = New Connection
Set cmd1 = New Command
Set rs1 = New Recordset
With con1
..ConnectionString = "data source=C:\Finalproject\Newentry.mdb"
..Provider = "Microsoft.Jet.OLEDB.4.0;Persist Security Info=False"
..Open
End With
cmd1.ActiveConnection = con1
rs1.Open "select PaySlipno,Empno,Empname from payslip", con1,
adOpenDynamic, adLockOptimistic
End

And also let me know how to perform add , delete, update command
using Data Controler, as i m learning this then tell me why this
connectivity is not working

Paul Clement

2005-11-29, 6:55 pm

On 28 Nov 2005 23:32:33 -0800, sheetalsuri11@gmail.com wrote:

¤ Here i m enclosing my code which i have used for connection this is
¤ basically for DAO (Data Controler) connectivity but in case of
¤ recordsource this gives an error like unrecogonized database
¤ Private Sub Form_Load()
¤ Set con1 = New Connection
¤ Set cmd1 = New Command
¤ Set rs1 = New Recordset
¤ With con1
¤ .ConnectionString = "data source=C:\Finalproject\Newentry.mdb"
¤ .Provider = "Microsoft.Jet.OLEDB.4.0;Persist Security Info=False"
¤ .Open
¤ End With
¤ cmd1.ActiveConnection = con1
¤ rs1.Open "select PaySlipno,Empno,Empname from payslip", con1,
¤ adOpenDynamic, adLockOptimistic
¤ End
¤
¤ And also let me know how to perform add , delete, update command
¤ using Data Controler, as i m learning this then tell me why this
¤ connectivity is not working

See the following:

PRB: Error "Unrecognized Database Format" When You Upgrade to Access 2000 or 2002
http://support.microsoft.com/defaul...kb;en-us;238401


Paul
~~~~
Microsoft MVP (Visual Basic)
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com