Hi all,
I am getting the following runtime error:
"Cannot perform '=' operation on System.DateTime and System.Int32."
But I can't understand where the Int32 is coming from!!
The code is:
Drv.BeginEdit()
Drv("Editor") = Me.Recorder.Text
Drv("CompletedDateTime") = Me.DateTime.Value
Drv.EndEdit()
So, I am setting the value of the CompletedDateTime column to the value
of a DateTime control on the form.
Strange, because in the code (on a different table, but the same
DateTime control it works perfectly: Drv("DateTime") = DateTime.Value
So - why is there a problem, and where is the System.Int32 it is
talking about?!?
When I debug during runtime, the value returned from Me.DateTime.Value
is #12/01/2006# and so on.
Even when I rewrite the code to:
Drv("CompletedDateTime") = #12/01/2006#
It still causes the same error!
I'm tearing my hair out here.. any help much appreciated.
Thanks! 6 1048
Jimmy,
Can you show us how you have instansed "your" object "DateTime" and what it
is.
The drv("Editor") item shows you a column with type DateTime with its
default value.
In another way tell us what you want to achieve.
Cor
<ji******@gmail.com> schreef in bericht
news:11**********************@z34g2000cwc.googlegr oups.com... Hi all,
I am getting the following runtime error:
"Cannot perform '=' operation on System.DateTime and System.Int32."
But I can't understand where the Int32 is coming from!!
The code is:
Drv.BeginEdit() Drv("Editor") = Me.Recorder.Text Drv("CompletedDateTime") = Me.DateTime.Value Drv.EndEdit()
So, I am setting the value of the CompletedDateTime column to the value of a DateTime control on the form.
Strange, because in the code (on a different table, but the same DateTime control it works perfectly: Drv("DateTime") = DateTime.Value
So - why is there a problem, and where is the System.Int32 it is talking about?!?
When I debug during runtime, the value returned from Me.DateTime.Value is #12/01/2006# and so on.
Even when I rewrite the code to: Drv("CompletedDateTime") = #12/01/2006# It still causes the same error!
I'm tearing my hair out here.. any help much appreciated.
Thanks!
Thanks for the reply,
"CompletedDateTime" is a column in an SQL database, of type Smalldate.
"Editor" is just a string (and it is working fine)..
Me.DateTime.Value refers to a Winforms DateTimePicker control.
Jimmy,
I would not name a DateTimePicker control DateTime, it is probably asking
for troubles.
DateTime is one of the main Types.
Cor
<ji******@gmail.com> schreef in bericht
news:11**********************@z34g2000cwc.googlegr oups.com... Thanks for the reply,
"CompletedDateTime" is a column in an SQL database, of type Smalldate. "Editor" is just a string (and it is working fine)..
Me.DateTime.Value refers to a Winforms DateTimePicker control.
Again, thanks for the ideas.. OK, I've changed the name of my Winforms
control to dtp1... but still no luck..
With some experimenting in my SQL database I located where the problem
is.
The "CompletedDateTime" field in the table is allowed to be null. When
i first populated the table, I left this field NULL, and it is set as a
'not required' field. If I go manually and change the data in SQL
server, from NULL to give it a date e.g. 12/2/2008 12:00:00AM it works
perfectly, no errors!
But when i edit the datarowview with
Drv("CompletedDateTime") = Me.DateTime.Value
well, it causes the error if the dataset field was previously NULL. if
it was previously set to a date, it works fine.
Would greatly appreciate some help!!
Many thanks!
Jimmy,
May I assume this is Drv("CompletedDateTime") = Me.DateTime.Value
Drv("CompletedDateTime") = dtp1.value
If the type of drv is DateTime, than it should in my opinion no proglem.
You can see this by
messagebox.show(TheOriginalTable.DataColumns("Comp letedDateTime").GetType.ToString)
I hope this helps,
Cor
OK problem solved - thanks for all the help! I was about to completely
give up!
In a previous section of code, I had the following:
Dv.RowFilter = "Isnull(CompletedDateTime, -1) = -1"
Now, I changed that to:
Dv.RowFilter = "Isnull(CompletedDateTime, 01/01/0001) =
01/01/0001"
And there are no problems. I wonder why though? I thought "Isnull"
simply returned whatever value you set if the column is null?
Is there any workaround, or do I always haveto use a ficticious date
with Isnull? (e.g. do I have to set it as 01/01/0001, or can I use a
string or something else??)
Anyway thank you. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Albert Spencil |
last post by:
This error shows when I check Netscape's "javascript:" . Doesn't seem
to present a problem as the site works OK. Still I would like to get
rid of it.
"Security Error: Content at...
|
by: Piotre Ugrumov |
last post by:
I have tried to modify my exercise about the simulation of the life in the
savannah. Now I have only 2 errors but I don't comprehend how resolve these
errors. If I try to call the method getX() and...
|
by: Greg N. |
last post by:
Sorry if this topic has been discussed before:
Is there any statistical data available about what percentage of
browsers run with JS disabled?
Thanks for any and all insights,
Greg
|
by: drhowarddrfine |
last post by:
I'm working on a web site that could use some control using js but am
concerned about what problems I may have with potential users having
their js turned off. Has anyone had any serious problems...
|
by: RG |
last post by:
Greetings friends,
This semester I have started a course in C programming. I was moving
along fine until I reached to the topic of loops (feeling embarrassed
among you elite programmers). My...
|
by: arcticool |
last post by:
I had an interview today and I got destroyed :(
The question was why have a stack and a heap?
I could answer all the practical stuff like value types live on the
stack, enums are on the stack, as...
|
by: Farmer |
last post by:
Hi, (I have also posted that question in
microsoft.public.access.security please respond there)
I have tried to find an answer to my question but I am finding it
impossible. This is the problem: I...
|
by: Frederick Gotham |
last post by:
The "toupper" function takes an int as an argument. That's not too
irrational given that a character literal is of type "int" in C.
(Although why it isn't of type "char" escapes me... )
The...
|
by: Cat |
last post by:
I created a web site, and I thought I followed XHTML 1.1 rules. But
when I validated the pages, I got some error messages. I found that
those codes are automatically generated parts by ASP.NET.
...
|
by: rocketboy2000 |
last post by:
could anyone provide me with some simple example code of asp classic
calling adodb? specifically, i'd like the code to:
- call a couple of stored procedures that have optional parameters
- share a...
|
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...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
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...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
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)...
|
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: 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....
|
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...
| |