connection problems

turrican

Active member
Joined
Jan 24, 2003
Messages
27
Location
Phoenix, Az
can someone tell me where I am going wrong here? This is driving me nuts.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim MyConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source= d:\DvdList.mdb;User Id=admin;")

MyConnection.Open()

it stops at the lasr line when I try to run it. I can connect to this database with the wizard but I want to learn how to do it like this. Please help.:confused: :confused: :confused:
 
it looks ok to me maybe your username or password is wrong??

try

Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
try
Dim MyConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source= d:\DvdList.mdb;User Id=admin;")
MyConnection.Open()
catch
msgbox(err.description)
end try

See what comes up as the error, bound to be simple.

http://www.computerhelp.forum/showthread.php?s=&threadid=69746

Check the above link for a simple ado.net tutorial

Andy
 
but i have a doubt

bot codes look the same excet that below we are handling an exception.
however handling exceptions is a good practice, it is not absolutely necessary

so i want to know where exactly was athe fault above.

please guide me.

Hemen
 
your right it is the same. I think that the problem was actualy in my sql command. I didnt have the reference to the connection at the end. I thought that the problem was with the connection because that is where the program originaly apeared to be stopping.
 
Back
Top