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@yhaoo.com','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? 2 2605
Access automatically creates an ldb (lock file) when you open a connection
to it, and will only remove it after you close the connection, you never
need to delete it. Your sql statement will have a problem, either because
it's using a reserved word i.e. I think password is reserved, so if you have
a field called that wrap it in square brackets [password], so Access knows
it's a field, or else you're not meeting a field requirement e.g. your phone
number is 10 characters and you've only allowed for 8.
Please note you should always wrap database access code in either try-catch
or Using blocks to ensure that if there is an error the connection is
correctly closed.
Cathal
"dale zhang" <da*******@discussions.microsoft.com> wrote in message
news:48**********************************@microsof t.com... 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@yhaoo.com','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?
Cathal,
Thank you very much. You are exactly right. Some words are reserved. I added
some of them with 1 at end. It is work fine now.
-Dale
"Cathal Connolly [VB MVP]" wrote: Access automatically creates an ldb (lock file) when you open a connection to it, and will only remove it after you close the connection, you never need to delete it. Your sql statement will have a problem, either because it's using a reserved word i.e. I think password is reserved, so if you have a field called that wrap it in square brackets [password], so Access knows it's a field, or else you're not meeting a field requirement e.g. your phone number is 10 characters and you've only allowed for 8.
Please note you should always wrap database access code in either try-catch or Using blocks to ensure that if there is an error the connection is correctly closed.
Cathal "dale zhang" <da*******@discussions.microsoft.com> wrote in message news:48**********************************@microsof t.com... 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@yhaoo.com','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? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: deko |
last post by:
Do I need to use flock() when reading a file into an array? It's possible that
the file in question could be open at the time the file('filename') request is
made. I realize flock() is required...
|
by: Sean C. |
last post by:
Helpful folks,
Most of my previous experience with DB2 was on s390 mainframe systems
and the optimizer on this platform always seemed very predictable and
consistent. Since moving to a WinNT/UDB...
|
by: dog |
last post by:
I've seen plenty of articles on this topic but none of them have been
able to solve my problem.
I am working with an Access 97 database on an NT4.0 machine, which has
many Access reports.
I...
|
by: Grasshopper |
last post by:
Hi,
I am automating Access reports to PDF using PDF Writer 6.0. I've
created a DTS package to run the reports and schedule a job to run this
DTS package. If I PC Anywhere into the server on...
|
by: Gery D. Dorazio |
last post by:
Here is some code to open a file with exclusive access for the purpose of
modifying it.
FileStream fstrm = new FileStream(inputFileName, FileMode.OpenOrCreate,
FileAccess.ReadWrite,...
|
by: mark |
last post by:
I have an asp.net ecommerce web application on a remote web server.
I'm using an Access database on the back end. I've notice a few
strange things. When I mimic an multiple user environment by...
|
by: Gary Nelson |
last post by:
Anyone have any idea why this code does not work?
FileOpen(1, "c:\JUNK\MYTEST.TXT", OpenMode.Binary,
OpenAccess.ReadWrite, OpenShare.Shared)
Dim X As Integer
For X = 1 To 26
FilePut(1, Chr(X +...
|
by: adri4n |
last post by:
as wat ive mentioned in the title.. im would like to know whether the a
particular record/table is being locked in my program. some of the
methods which i would like to develop are as below:
...
|
by: Frav |
last post by:
The Reps team have been experiencing that Access 2002 unexpectedly
quits
while working and also lots of Corruption Failures and "Record lock
can not
update" messages since the upgrade from...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |