473,326 Members | 2,124 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,326 software developers and data experts.

Datagrid Update Problem

I have a very weird problem in updating my datagrid. Please help me to solve
it. The datagrid is tied to a dataset table with five columns. Three of them
are primary key and the other two columns are the ones that are of interest.
These
two columns have "date" type values and shows short time (i.e. 11:39).
The program updates the database if I change the values in these columns, or
add a new record, or
delete a record. But, if one of these two columns have null value, it won't
let me to enter a new value to that column. And the error it gives is
"concurrency
violation. 0 rows are updated." Again, if one of these two columns have null
value,
and if I try to modify the other column's value, again it doesn't do the
update and the
error tells that it cannot cast "" string to date type.

Please give me any idea that might help me to solve this problem,
Thanks in advance
Reney

Nov 20 '05 #1
4 5285
Hi Reney,

You came to us yesterday with your query. Unfortunately no-one has had a
solution for you.

I've got a couple of questions that may take us a bit further. :-)

1) When you say 'updating when a date is null'. Do you mean that you can
create a new record with one valid date and one null and <then> you can't
change the null date? Or do you mean that you can't create a new record with a
null date <in the first place>?

2) What happens if you try and update where <both> dates are null. Same
error? or does it only happen when one is null?

3) What constraint, if any, have you set up on these fields in the
database. Are they set to must-be-non-null? It's possible, perhaps, that you
are getting a misleading error message pointing you in the wrong direction.

4) Can you update new records in Access itself - ie. manually. If not,
does it give the same error message or something more useful?

Regards,
Fergus
Nov 20 '05 #2
Hi Fergus, thanks for your interest. Let me explain the problem a little
bit further. In the program, a user can clock-in (Simply the current
time is written in the "ClockStart" column of the TimeLog table). User
can also clock out with the same procedure(Those are accomplished with
another form class). The form that I am working on and having problems
is the timelog form, where a user can view all the clock-ins and outs
for the previous week.
This is shown with a datagrid. What I am trying to do is, if the user
forgot to clock out, a clock out value could be entered using this
datagrid later.

In this datagrid, I can change the clock-in and clock-out values and
update it successfuly. It also lets me to delete records or add new
records if I enter all the fileds in the correct format. But if the
clock-out value is null (which means, the user has clocked in first, but
not clocked out yet), I cannot update the datagrid when I enter a new
time value in the clock out field. This error is given:
"Concurrency violation: the update command affected 0 records."

And in response to you questions:
1) When you say 'updating when a date is null'. Do you mean that you can
create a new record with one valid date and one null and <then> you
can't change the null date? Or do you mean that you can't create a new
record with a
null date <in the first place>?
Actually, in this form, I cannot create a new record with a null value
in one of the date fields. Then this error is given:
"Cast from type 'DBNull' to type 'Date' is not valid. Do you want to
correct the value?"

2) What happens if you try and update where <both> dates are null. Same
error? or does it only happen when one is null?

It gives me the same error as it gives when one is null.
"Concurrency violation: the update command affected 0 records."

3) What constraint, if any, have you set up on these fields in the
database. Are they set to must-be-non-null? It's possible, perhaps, that
you are getting a misleading error message pointing you in the wrong
direction.

I haven't set up any constraints on these two fields in the database.
Their required field is set to 'No'(with Access terminology), they have
data/time data type with short time format.

4) Can you update new records in Access itself - ie. manually. If not,
does it give the same error message or something more useful?

In Access, I can update them manually without any error.

I hope I could explain the problem clearly. Please let me know if there
is anything not clear enough. Thanks for your time,
Reney


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #3
Hi Reney,

I was hoping that you'd be able to report something out of the ordinary
and we could point our fingers and say "Aha!!". Unfortunately that isn't the
case and I have reached the limit of my knowledge in this area.

This newsgroup is actually for issues with VB itself, although we get
asked allsorts. Those of us who know anything about databases will help as
best we can.

There is, however, a dedicated ADO.NET newsgroup where the real database
experts hang out:
news://msnews.microsoft.com/microsof...amework.adonet

Maybe someone else <here> who will have some more ideas, but I'd recommend
that you post your query to the ADO people too.

If you do, make sure that you provide all the information that you have
given us, ie. your original post plus the Update SQL from your response to One
Handed Man and finally the answers to my questions above. Giving them all the
information will save them asking questions that you already have the info
for.

Sorry I can't take you to a conclusion. :-(
All the best. :-)

Regards,
Fergus
Nov 20 '05 #4
Hi Fergus,

Thanks for taking your time to help me, and also providing me the ado
news group's link. I will go ahead and post my question in this group
now.

Best regards,
Reney

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Chris Plowman | last post by:
Hi all, I was wondering if anyone can help me with a really annoying problem I have been having. I made a derived datagrid class that will select the row when a user clicks anywhere on a cell...
9
by: Pam Ammond | last post by:
After clicking btnDeleteSize_Click in frmSize, I move to frmSizeDelete, allow deleting a Size using a datagrid, and then return to frmSize and want to update the datagrid in frmSize to reflect the...
4
by: Glenn Owens | last post by:
I have a DataGrid web control which I've dynamically populated with template columns to be used for bulk-editting. Generally, all of the columns are textbox and/or dropdownlist child controls. ...
1
by: Rick | last post by:
Hello all, I hope all is well with you. I am having a seriously difficult time with this problem. Allow me to set up the problem. I have a System.Web.UI.Page with the following controls...
0
by: Steve | last post by:
I have a datagrid that is created at run time DataGrid dgG = new DataGrid(); BoundColumn bcB; dgG.CellPadding = 5; dgG.CellSpacing = 0; dgG.GridLines = GridLines.Both; dgG.CssClass =...
4
by: tshad | last post by:
I am having trouble with links in my DataGrid. I have Links all over my page set to smaller and they are consistant all over the page in both Mozilla and IE, except for the DataGrid. Here is a...
5
by: junglist | last post by:
Hi guys, I've been trying to implement an editable datagrid and i have been succesful up to the point where i can update my datagrid row by row. However what used to happen was that once i updated...
5
by: Tina | last post by:
the Edit, Update, Cancel, and Delete buttons in my datagrid are causing validation elsewhere on the page. I want to specify that these buttons should not cause validation but they have no design...
17
by: A_PK | last post by:
I have problem databinding the DataGrid with DataView/DataSet after the filter... I create the following proceudre in order for user to filter as many as they want, but the following code is only...
9
by: rn5a | last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB table. Users can modify the records using this DataGrid for which I am using EditCommandColumn in the DataGrid. This is the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
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 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.