MS Access LDB file (lock) and INSERT Failure
- From: "dale zhang" <dalezhang@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 25 Aug 2005 15:15:01 -0700
Hi,
I am writing a subscription page in C#. I first check if username is unique by
"SELECT UserName FROM Logins WHERE Username ='dadada'"
Then if unique, I create the user by
"INSERT INTO Logins
(UserName,UserType,Password,StartDate,Status,Email,Phone,Home) VALUES
('dadada','u','dadadada',#8/25/2005 5:22:33
PM#,'trial','d@xxxxxxxxx','1231231231','10 brechk st., bridgewater, nj
08807')"
Somehow this always returns exception after running dbCmd.ExecuteNonQuery()
as below
"Syntax error in INSERT INTO statement."
I checked the syntax many times, could not find anything wrong.
When user logins in, I update the DB successfully as below:
"INSERT INTO Visits (Email,LoginDate,ReferPage,LoginOK,LoginPass,IP) VALUES
('admina',#8/25/2005 5:25:16
PM#,'/passwordProtectCSharp/privatePage.aspx',1,'adminabc','127.0.0.1')"
So access to DB is OK. I suspect my first reading to Logins table caused ldb
lock. So I can not insert afterwards. After removing the check of uniqueness,
I still have the same error.
Any suggestions? Thanks. -Dale
PS. ldb file sometimes stays there for a long time, sometimes it disappears
soon after code is stopped. can not delete it. any way to control it?
.
- Follow-Ups:
- Re: MS Access LDB file (lock) and INSERT Failure
- From: Cathal Connolly [VB MVP]
- Re: MS Access LDB file (lock) and INSERT Failure
- Prev by Date: Re: Firing cross thread events...
- Next by Date: Re: Performance in csharp, scientific simulation
- Previous by thread: DataGrid Row Changes due to user navigation
- Next by thread: Re: MS Access LDB file (lock) and INSERT Failure
- Index(es):
Relevant Pages
|