Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Database and Reporting > Connection String


Reply
 
Thread Tools Display Modes
  #1  
Old 10-05-2000, 12:23 PM
dccooper
Guest
 
Posts: n/a
Question Connection String


I want to connect a VB form to a MS Access table using ADO and setting the connection string at Form_Load event using with the App.Path syntax so the application can run as a stand-alone.

The only options I can find are:
1.Connect setting everything Programmatically
2.Connect setting everything in advance through the Properties (app.path does not work)

The code Below does not work and I can't understand why?

Private Sub Form_Load()
On Error GoTo Err_Form_Load

Dim strConnection As String

strConnection = "Provider=Microsoft.Jet.OLEDB.3.51;" & _
"Persist Security Info=False;Data Source=" & App.Path & "MudPITVB.mdb"

Me.adProgram.ConnectionString = strConnecction
Me.adProgram.CommandType = adCmdTable
Me.adProgram.RecordSource = "tblprograms"

Exit_Form_Load:
Exit Sub

Err_Form_Load:
MsgBox "Error Number: " & Err.Number & " - " & Err.Description
Resume Exit_Form_Load
End Sub

Please...I know this is probably very basic but I would appreciate any help?

Reply With Quote
  #2  
Old 10-09-2000, 02:33 PM
makai
Guest
 
Posts: n/a
Default Re: Connection String

perhaps open might do it

adProgram.ConnectionString = strConnecction
adProgram.CommandType = adCmdTable
adProgram.RecordSource = "tblprograms"
adProgram.Open


Reply With Quote
  #3  
Old 10-10-2000, 03:27 PM
dccooper
Guest
 
Posts: n/a
Default Re: Connection String

Thanks, I tried and there is no open method for the ADO data control object. Perhaps I overstated the problem above. I have a stand-alone app and simply want to set the connection string to "app.path" using the ADO Data control. Surely, this control can not be limited to network applications. Thanks for your help.

Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->