Question Connection to database

ulynen

Member
Joined
Feb 18, 2015
Messages
22
Programming Experience
5-10
I have a small bit of test code:
Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Dim connectionstring As String = "Provider=Microsoft.jet.oledb.4.0;data source=C:\PPCIS745DemoData\CallerID.mdb"
Dim con As OleDbConnection = New OleDbConnection(connectionstring)
Dim cmd As New OleDbCommand

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim connection As New OleDbConnection(connectionstring)
Try
connection.Open()
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "qdelworkmaxday"
End Sub
End Class

I can't seem to get the connection to open. It does not throw and exception.
 
One interesting point. When the connection.Open() is executed there is an ldb file created and it is gone when the app is done. So obviously there is some kind of connection but nothing happens when you execute a query or stored procedure.
 
Thanks for your help. I have it working. I will also do a better job of including code in future.
 
Last edited:
Back
Top