473,657 Members | 2,735 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Update query syntax for datagrid

18 New Member
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.dataGriedV iew1.CurrentRow .Cell[0].Value.ToString () + ", Date=" +
"to_date(" + this.dataGriedV iew1.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 2195
enreil
86 New Member
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.dataGriedV iew1.CurrentRow .Cell[0].Value.ToString () + ", Date=" +
"to_date(" + this.dataGriedV iew1.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
5006
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)
4
11327
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 AddressDescription of Entity 456 = AddressDescription of Entity_ID 123 Address1 of Entity 456 = Address1 of Entity_ID 123 City of Entity 456 = City of Entity_ID 123
7
3527
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" Transactions = name of the table I want to update balance = name of the field i want to update daily balance= name of the query result that I want to move to the table
3
2210
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 make the changes and click Update, it reverts back to the old value. I'm stumped! I've also checked the db table and it is infact not updating. I'm attempting to follow and example right out of ASP.NET Unleashed but not having much luck. Any...
4
1666
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 update my database, I am able to get the form fields, and I am able to replace the data, but when I go "update", the old data remains. I have done everything correct, including this:
25
4055
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
1
2767
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 came up with a crazy stored proc. As in this example I would only update and : CREATE PROCEDURE . ( @Description varchar(1000),
2
6410
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 field to change from a "1" to a "0" (and vica versa). I have the bindings worked out, I just can't figure out how to do the update. Here is my source:
3
1874
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 not there, of course. How do I get that field back into the datatable for the database update? TIA, Larry Woods
0
8837
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, 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...
0
8739
jinu1996
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...
0
8612
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7347
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, 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...
0
4171
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...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2739
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.