473,407 Members | 2,315 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Update query syntax for datagrid

18
we are having a sql query error when we are trying to update values from the datagridview to access database. The problem is because of date(because of its format), a runtime error pops up saying that "missing operator in query expression "to_date(2/2/2007 12:00:00 AM, "mm/dd/yy")"

we are only interested in date portion and not the time.
this our command string

cmd = "update Inventory Set itemDescription=" + this.dataGriedView1.CurrentRow.Cell[0].Value.ToString() + ", Date=" +
"to_date(" + this.dataGriedView1.CurrentRow.Cell[1].Value.ToString() + "," + "mm/dd/yy" + ")" +
" where ItemNumber=" +
int.parse(this.dataGriedView1.CurrentRow.Cell[2].Value.ToString());

there are many columns, I haven't showed here because I know the problem is with date only.

Thanks in advance.
Feb 2 '07 #1
1 2188
enreil
86
A question very similar to yours was on this forum a few days ago - you can read it here. This question dealt with SQL dates, but you should be able to make the adjustment for Access. Hope that helps.

we are having a sql query error when we are trying to update values from the datagridview to access database. The problem is because of date(because of its format), a runtime error pops up saying that "missing operator in query expression "to_date(2/2/2007 12:00:00 AM, "mm/dd/yy")"

we are only interested in date portion and not the time.
this our command string

cmd = "update Inventory Set itemDescription=" + this.dataGriedView1.CurrentRow.Cell[0].Value.ToString() + ", Date=" +
"to_date(" + this.dataGriedView1.CurrentRow.Cell[1].Value.ToString() + "," + "mm/dd/yy" + ")" +
" where ItemNumber=" +
int.parse(this.dataGriedView1.CurrentRow.Cell[2].Value.ToString());

there are many columns, I haven't showed here because I know the problem is with date only.

Thanks in advance.
Feb 2 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

17
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...
4
by: deko | last post by:
I'm trying to update the address record of an existing record in my mdb with values from another existing record in the same table. In pseudo code it might look like this: UPDATE tblAddress SET...
7
by: Mark Carlyle via AccessMonster.com | last post by:
I have this update query that I am trying to run. I know the syntax is messed up but do not know how to correct it. Select 'UPDATE', Transactions,'Set = where = ' From "Get Daily Balances" ...
3
by: D. Shane Fowlkes | last post by:
I have a Datagrid which in theory, should allow you to edit and update the records. I've stripped my test page down so that it's only attempting to update one field - "description". Yet when I...
4
by: René Kabis | last post by:
People, I am at my wit's end. I am using the exact code from http://aspnet.4guysfromrolla.com/articles/071002-1.aspx And yet, the code does not manage to update the database. When I go to...
25
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
1
by: Mok | last post by:
Hello, I want to pull information from a table in sql server, bind it to a grid and update those values. I would like to know the best way to do it. I used the configure data adapter wizard and it...
2
by: Nu2ASP.NET | last post by:
What I am trying to do is essentially 'flip' the bits, when the user clicks in the checkbox. For example, if the CheckBox appears checked, and the user un-checks it, I want the underlying data...
3
by: Larry Woods | last post by:
I have a datagrid that is carrying all fields of a record...except one. Now I want to update the underlying database via a dataadapter. The update is working but the field that is "left out" is...
0
BarryA
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
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,...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.