hi guys, my prblem is that I cannot update sql query against MS ACCESS
using C#. Everytime wen i do so, i got an exception (at runtime) as
'UPDATE syntax not correct'. I don find any error in my 'update'
syntax.
I can successfully run other dbase operations like insertion, deletion
& all.; except Updation.
But, i can successfully run the same update query in the 'sql query
tab' of MS ACCESS, and is executed successfully.
I'm using VS.NET 2005 & MS ACCESS 2003.
please help me...its urgent.
i'm including the code below :
*************** *************** *************** *************** *****
string provider = "Provider = Microsoft.Jet.O leDb.4.0; Data Source =
db1.mdb;";
string sql = "update Table1 set Password = 'modify' where ID =
'abhi'";
try
{
OleDbConnection oc = new OleDbConnection (provider);
OleDbCommand od = new OleDbCommand(sq l, oc);
oc.Open();
od.ExecuteNonQu ery();
oc.Close();
}
catch (Exception exp)
{
return exp.Message;
}
*************** *************** *************** *************** *****
My table contains two field : "ID" & "Password", both are of String
type.
*************** *************** *************** *************** *****
thanks in advance 5 3238
I'm not sure, but perhaps it is the quotes in the string (mabye it is
looking for a double-quote)?
I doubt that your string is a constant like that, but rather, a string
that you concatenate together. In this case, you should use a parameterized
query, and let the provider handle the parameter formatting issues for you.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
<ab************ @gmail.comwrote in message
news:61******** *************** ***********@a39 g2000pre.google groups.com...
>
hi guys, my prblem is that I cannot update sql query against MS ACCESS
using C#. Everytime wen i do so, i got an exception (at runtime) as
'UPDATE syntax not correct'. I don find any error in my 'update'
syntax.
I can successfully run other dbase operations like insertion, deletion
& all.; except Updation.
But, i can successfully run the same update query in the 'sql query
tab' of MS ACCESS, and is executed successfully.
I'm using VS.NET 2005 & MS ACCESS 2003.
please help me...its urgent.
i'm including the code below :
*************** *************** *************** *************** *****
string provider = "Provider = Microsoft.Jet.O leDb.4.0; Data Source =
db1.mdb;";
string sql = "update Table1 set Password = 'modify' where ID =
'abhi'";
try
{
OleDbConnection oc = new OleDbConnection (provider);
OleDbCommand od = new OleDbCommand(sq l, oc);
oc.Open();
od.ExecuteNonQu ery();
oc.Close();
}
catch (Exception exp)
{
return exp.Message;
}
*************** *************** *************** *************** *****
My table contains two field : "ID" & "Password", both are of String
type.
*************** *************** *************** *************** *****
thanks in advance
ab************@ gmail.com wrote:
hi guys, my prblem is that I cannot update sql query against MS ACCESS
using C#. Everytime wen i do so, i got an exception (at runtime) as
'UPDATE syntax not correct'. I don find any error in my 'update'
syntax.
I can successfully run other dbase operations like insertion, deletion
& all.; except Updation.
But, i can successfully run the same update query in the 'sql query
tab' of MS ACCESS, and is executed successfully.
string provider = "Provider = Microsoft.Jet.O leDb.4.0; Data Source =
db1.mdb;";
string sql = "update Table1 set Password = 'modify' where ID =
'abhi'";
Maybe password is a reserved word.
Try:
string sql = "update Table1 set [Password] = 'modify' where ID = 'abhi'";
Arne
On 24 Nov, 16:57, Arne Vajhøj <a...@vajhoej.d kwrote:
abhilashcas...@ gmail.com wrote:
hi guys, my prblem is that I cannot update sql query against MS ACCESS
using C#. Everytime wen i do so, i got an exception (at runtime) as
'UPDATE syntax not correct'. I don find any error in my 'update'
syntax.
I can successfully run other dbase operations like insertion, deletion
& all.; except Updation.
But, i can successfully run the same update query in the 'sql query
tab' of MS ACCESS, and is executed successfully.
string provider = "Provider = Microsoft.Jet.O leDb.4.0; Data Source =
db1.mdb;";
string sql = "update Table1 set Password = 'modify' where ID =
'abhi'";
Maybe password is a reserved word.
Try:
string sql = "update Table1 set [Password] = 'modify' where ID = 'abhi'";
Arne
check if an @ might help... donno why but test string sql = @"update
Table1 set Password = 'modify' where ID = 'abhi'";
dont think password is reserved, but new to c#
//CY ch*******@gmail .com wrote:
On 24 Nov, 16:57, Arne Vajhøj <a...@vajhoej.d kwrote:
>abhilashcas... @gmail.com wrote:
>>hi guys, my prblem is that I cannot update sql query against MS ACCESS using C#. Everytime wen i do so, i got an exception (at runtime) as 'UPDATE syntax not correct'. I don find any error in my 'update' syntax. I can successfully run other dbase operations like insertion, deletion & all.; except Updation. But, i can successfully run the same update query in the 'sql query tab' of MS ACCESS, and is executed successfully. string provider = "Provider = Microsoft.Jet.O leDb.4.0; Data Source = db1.mdb;"; string sql = "update Table1 set Password = 'modify' where ID = 'abhi'";
Maybe password is a reserved word.
Try:
string sql = "update Table1 set [Password] = 'modify' where ID = 'abhi'";
check if an @ might help... donno why but test string sql = @"update
Table1 set Password = 'modify' where ID = 'abhi'";
The @ should not have any impact here - no \ characters.
dont think password is reserved
http://support.microsoft.com/kb/248738 claims it is.
Arne This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jochen Daum |
last post by:
Hi !
I have this upate statement which gets sent to MS SQL:
update MsgOutgoing set SenderResource = NULL,RecipientAddress =
'xxxxxxxxx',EarliestSentDateTime = NULL,LatestSentDateTime =
'2003-11-15 14:41:03.060',SentDateTime = '2003-11-17
11:40:06.000',RecipientResource = '313',FailCounter = 0,DeliveryMedium
= 'SMS',Content = 'can u do a job xxxxxxxx job#NOxxxxon monday urgent
my muckup sorryxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"‹° úcan' where...
|
by: Michel |
last post by:
Hi All,
In Oracle, I can easily make this query :
UPDATE t1 SET (f1,f2)=(SELECT AVG(f3),SUM(f4)
FROM t2
WHERE t2.f5=t1.f6)
WHERE f5='Something'
I cannot seem to be able to do the same thing with MS-SQL. There are
|
by: Karaoke Prince |
last post by:
Hi There,
I have an update statement to update a field of a table (~15,000,000
records). It took me around 3 hours to finish 2 weeks ago. After that
no one touched the server and no configuration changed. Until
yesterday, I re-ran it again and it took me more than 18hrs and still
not yet finished!!!
What's wrong with it? I can ran it successfully before. I have tried
two times but the result was still the same.
|
by: R Camarda |
last post by:
I have the following statement that takes quite a long time. Longest
of any of my SQL statment updates.
UPDATE F_REGISTRATION_STD_SESSION
SET PREVIOUS_YEAR_SESSION_ID = (
SELECT s.previous_year_session_id
FROM F_REGISTRATION_STD_SESSION R
,DS_V4_TARGET.dbo.D_H_Session_By_SessQtr S
WHERE
r.STUDENT_ID = F_REGISTRATION_STD_SESSION.STUDENT_ID
|
by: kalamos |
last post by:
This statement fails
update ded_temp a
set a.balance = (select sum(b.ln_amt)
from ded_temp b
where a.cust_no = b.cust_no
and a.ded_type_cd = b.ded_type_cd
and a.chk_no = b.chk_no
group by cust_no, ded_type_cd, chk_no)
| |
by: Riley DeWiley |
last post by:
Using OLEDB, Jet 4.0, C++, Windows.
I have been baffled by UPDATE queries that return S_OK but do not change the
data in the database. It seems that UPDATEs do not update until the
CDataSource object goes out of scope, in some cases, they seem not to update
at all. Apparently the data is being cached and transmitted through some
kind of flushing mechanism.
I would like to "force" writes of data after executing an UPDATE query
through...
|
by: David Linsin |
last post by:
I created a simple test case to reproduce the problem (also check Bug
#15500):
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
/**
* Simple test program to reproduce bug
|
by: technocraze |
last post by:
Hi guys,
I have encountered this error when updating the values to the MS Acess table.
Error : Update on linked table failed. ODBC sql server error Timeout expired. MS Acess is my front end and sql server is my backend server.
This error occured whenever i step through and when it reaches rs.update it jux hangs down there and thereafter it shwn the aforementioned error. I am using the RecordSet properties to add the values. Can I use...
|
by: justapawn |
last post by:
Can someone assist me in using the correct syntax or method of assigning a variable to the Set portion of a DoCmd.RunSQL Update Query?
The help file and most sites, including ms, seem to think the set new_value portion is always going to be a constant.
I've tried:
Dim vbl as String
vbl = " a calculated choice that is not on a form"
' if it were a control on a form, I can use ! ... etc.
DoCmd.RunSQL "Update SomeTable Set SomeColumn =...
|
by: Neil |
last post by:
I'm running an update query in SQL 7 from QA, and it runs forever. Has been
running for 20 minutes so far! The query is quite simple: update a single
field in a table, based on a join with another table. There are a total of
1200 rows that are affected (out of a total of 60,000 in the table). Should
not take 20 minutes! Also, retrieving the 1200 rows using the same criteria
is instantaneous.
Anyone have any idea what's going on? Here's...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |