Question cannot add data to my access 2007 table

idzaan

New member
Joined
Mar 12, 2012
Messages
3
Programming Experience
Beginner
i try to add record to my user table but it appears errors on cnn.open says that
"The Microsoft Jet database engine cannot open the file 'C:\Users\avengers\Documents\QPG\QPG\bin\Debug'. It is already opened exclusively by another user, or you need permission to view its data."

this is my code.pless help me

Dim cmd As New OleDb.OleDbCommand
If Not cnn.State = ConnectionState.Open Then
cnn.Open()
End If


cmd.Connection = cnn
cmd.CommandText = "INSERT INTO userTable(Username, Password) " & _
" VALUES(" & Me.username1.Text & ",'" & Me.password1.Text & "')"


cmd.ExecuteNonQuery()


cnn.Close()
 
Is that really what it says? If so then the issue is that you have specified a folder path instead of a file path for your database. If that's not the actual error message then I suggest that you be a bit more careful to post the actual information in future. If you do have the correct path then I assume that you have opened the file some other way before making that connection.
 
tanks for your respond.but i still dont understand.is there any example or method that u can show me.my first early basis is on login.i manage to do the login but failed to do the register.pless help me.
 
There's examples all over the web. I'm here to help people learn how to program. If you don't know how to search the web then that's a skill you should probably learn elsewhere.

As for what I posted earlier, you do know the difference between a file and a folder, right? This:
"The Microsoft Jet database engine cannot open the file 'C:\Users\avengers\Documents\QPG\QPG\bin\Debug'. It is already opened exclusively by another user, or you need permission to view its data."
is the path of a folder. You are supposed to provide the path of your database file in the connection string, not the folder it's stored in.
 
i'm a newbie.what do u expect.
I expect anyone who thinks that they will be able to develop software to already have basic computer skills, e.g. to know the difference between a file and a folder or be able to search the web effectively.
 
Back
Top