hi all, i'm trying to insert the time/date a button was clicked on a gridview and it generates an error:the string was not recognized as a valid DateTime.There is an unknown word starting at index 0 i have changed the culture to en-US but it still doesn't work. i actually created the date/time column after some data had been entered into the table so the column allows nulls. this is my code:
InsertCommand="INSERT INTO test101(Surname,Names,Registration,Date/Time)VALUES (@Surname, @Names, @Registration,@DateTime,getdate())"
<Insert Parameters><asp:Parameter DefaultValue= DateTime.Now() Type=DateTime Name="DateTime" /></Insert Parameters>
any suggestions?
10 4072
You shouldn't be using DateTime.Now() but instead be using DateTime.Now, as Now is not a function.
If it doesn't like that, try DateTime.Now.ToString()
Have you tried Now()? I seem to recall getDate returning the name of the day first, so depends on the design of your table.
You shouldn't be using DateTime.Now() but instead be using DateTime.Now, as Now is not a function.
If it doesn't like that, try DateTime.Now.ToString()
now the error says "conversion failed when converting DateTime from character to string"
How did you name a colum "Date/Time" what is it's data type?
Have you checked the msdn on what datatypes convert to what?
hi all, i'm trying to insert the time/date a button was clicked on a gridview and it generates an error:the string was not recognized as a valid DateTime.There is an unknown word starting at index 0 i have changed the culture to en-US but it still doesn't work. i actually created the date/time column after some data had been entered into the table so the column allows nulls. this is my code:
InsertCommand="INSERT INTO test101(Surname,Names,Registration,Date/Time)VALUES (@Surname, @Names, @Registration,@DateTime,getdate())"
<Insert Parameters><asp:Parameter DefaultValue= DateTime.Now() Type=DateTime Name="DateTime" /></Insert Parameters>
any suggestions?
the fields you want to be populated are surname, name, registration, date/time (4 fields)
and you are passing 5 values.... you should rather get an sql error
what is the statement @DateTime,getdate() in your sql.I guess this is creating the problem
hi guys, thanks for all your input. i tried all your suggestions but unfortunately non of them worked.any more?
If your column is really called "Date/Time" then:
InsertCommand="INSERT INTO test101(Surname,Names,Registration,Date/Time)VALUES (@Surname, @Names, @Registration,@DateTime)"
<Insert Parameters><asp:Parameter DefaultValue= DateTime.Now Type=DateTime Name="DateTime" /></Insert Parameters>
If your column is really called "Date/Time" then:
InsertCommand="INSERT INTO test101(Surname,Names,Registration,Date/Time)VALUES (@Surname, @Names, @Registration,@DateTime)"
<Insert Parameters><asp:Parameter DefaultValue= DateTime.Now Type=DateTime Name="DateTime" /></Insert Parameters>
i've tried that before and when i do that, the error is
:the string was not recognized as a valid DateTime.There is an unknown word starting at index 0
I dunno then. It works for me.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jim |
last post by:
Any idea what is causing this error? 006~ASP
0230~Server.Transfer Error~The call to Server.Transfer
failed while loading the page.
Just read about benefits of Server.Transfer over...
|
by: microsoft |
last post by:
Hi People, when I try to modify an active directory user programatically, I
receive the following exception:
The server is unwilling to process the request
Reading the microsoft web site, I...
|
by: yelena |
last post by:
Hello,
We need to use version php-4.4.0-Win32 because one of the portal software
doesn't support version php-5.0.5-Win32. We cannot get the PHP setup part
working. Here is the error message:
...
|
by: chippy |
last post by:
Hi,
I've a VB script that creates a Access object in a word doc.
Here is the full script.
It works for all but the Export. Which always fails with a 3011 error.
If I do the same in Access as a...
|
by: Mr. x |
last post by:
Hello,
If I did :
try
... do something
catch
... do something
end try
....
|
by: Adrian Turner |
last post by:
I am just starting developing with .Net(Have used asp for years). I have
created a very simple upload page which once uploaded opens the file(excel)
and displays the data. If I Attempt to re-run...
|
by: Omatase |
last post by:
Here is my code:
CDO.Message iMessage = new CDO.MessageClass();
string sFrom; string sDate;
iMessage.DataSource.Open(bstrURLItem,null,
ADODB.ConnectModeEnum.adModeRead,...
|
by: Mad Scientist Jr |
last post by:
For some reason I can't get a WebClient to access an outside URL from
behind our firewall. The code works when it runs outside the firewall.
I turned on windows authentication in the web.config...
|
by: agarwalsunitadhn |
last post by:
Hi
I want to declare a coonectionstring in winapps as declared in web.config file in webapps.
I declare that in app.config as follows
<connectionStrings>
<add...
|
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: 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: 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: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
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: 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: 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
| |