I got help from Cor L, but is not finished yet.
In a windows form I need to add a date to a table in Access.
Dim dteDato As Date = (Me.txtDato.Text) ' I have tried Value instead of
Text, but it doesn't help
Dim con As New OleDb.OleDbConnection("Provider=Micr.....
Dim cmd As New OleDb.OleDbCommand("INSERT INTO tblToDo ( Dato ) SELECT " &
dteDato, con)
....
The dteDato shows as #6/30/2006#
The table in access has the field as Date, Short date.
The message I get is Syntax error in number in query expression 30.06.2006
(norwegian format)
I can't find ut what's wrong.
reidarT 3 963
Reidar,
I saw you changed your dateandtime already on your computer,
However can you declare further, is this an insert commando from a
dataadapter or just an insert commando for an executenonquery
Cor
"reidarT" <re****@eivon.no> schreef in bericht
news:uO**************@TK2MSFTNGP02.phx.gbl... I got help from Cor L, but is not finished yet.
In a windows form I need to add a date to a table in Access.
Dim dteDato As Date = (Me.txtDato.Text) ' I have tried Value instead of Text, but it doesn't help Dim con As New OleDb.OleDbConnection("Provider=Micr..... Dim cmd As New OleDb.OleDbCommand("INSERT INTO tblToDo ( Dato ) SELECT " & dteDato, con) ... The dteDato shows as #6/30/2006# The table in access has the field as Date, Short date. The message I get is Syntax error in number in query expression 30.06.2006 (norwegian format) I can't find ut what's wrong. reidarT
I have found the solution.
Dim dteDato As String = (Me.txtDato.Text)
Dim dteDato2 As String = "#" & Mid(dteDato, 4, 2) & "/" &
Mid(dteDato, 1, 2) & "/" & Mid(dteDato, 7, 4) & "#"
Then it works OK
Thanks for your help!
reidarT
"Cor Ligthert [MVP]" <no************@planet.nl> skrev i melding
news:ea**************@TK2MSFTNGP05.phx.gbl... Reidar,
I saw you changed your dateandtime already on your computer,
However can you declare further, is this an insert commando from a dataadapter or just an insert commando for an executenonquery
Cor
"reidarT" <re****@eivon.no> schreef in bericht news:uO**************@TK2MSFTNGP02.phx.gbl...I got help from Cor L, but is not finished yet.
In a windows form I need to add a date to a table in Access.
Dim dteDato As Date = (Me.txtDato.Text) ' I have tried Value instead of Text, but it doesn't help Dim con As New OleDb.OleDbConnection("Provider=Micr..... Dim cmd As New OleDb.OleDbCommand("INSERT INTO tblToDo ( Dato ) SELECT " & dteDato, con) ... The dteDato shows as #6/30/2006# The table in access has the field as Date, Short date. The message I get is Syntax error in number in query expression 30.06.2006 (norwegian format) I can't find ut what's wrong. reidarT
For formatting the date you could use this:
Dim dteDato As DateTime = DateTime.Parse(Me.txtDato.Text)
Dim dteDato2 As String = dteDato.ToString("#MM/dd/yyyy#")
On Fri, 30 Jun 2006 15:01:13 +0200, "reidarT" <re****@eivon.nowrote:
>I have found the solution.
Dim dteDato As String = (Me.txtDato.Text)
Dim dteDato2 As String = "#" & Mid(dteDato, 4, 2) & "/" & Mid(dteDato, 1, 2) & "/" & Mid(dteDato, 7, 4) & "#" Then it works OK Thanks for your help! reidarT "Cor Ligthert [MVP]" <no************@planet.nlskrev i melding news:ea**************@TK2MSFTNGP05.phx.gbl...
>Reidar,
I saw you changed your dateandtime already on your computer,
However can you declare further, is this an insert commando from a dataadapter or just an insert commando for an executenonquery
Cor
"reidarT" <re****@eivon.noschreef in bericht news:uO**************@TK2MSFTNGP02.phx.gbl...
>>>I got help from Cor L, but is not finished yet.
In a windows form I need to add a date to a table in Access.
Dim dteDato As Date = (Me.txtDato.Text) ' I have tried Value instead of Text, but it doesn't help Dim con As New OleDb.OleDbConnection("Provider=Micr..... Dim cmd As New OleDb.OleDbCommand("INSERT INTO tblToDo ( Dato ) SELECT " & dteDato, con) ... The dteDato shows as #6/30/2006# The table in access has the field as Date, Short date. The message I get is Syntax error in number in query expression 30.06.2006 (norwegian format) I can't find ut what's wrong. reidarT This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mingus Tsai |
last post by:
Hello- please help with unpickling problem:
I am using Python version 2.3.4 with IDLE version 1.0.3 on a Windows
XPhome system.
My problem is with using cPickle to deserialize my pickled...
|
by: Rey |
last post by:
Howdy all.
My problem deals w/inserting nulls into database (SQL Svr 2K) for the
datetime fields activityDate and followUpDate where nulls are allowed.
>From the web form, the user can type...
|
by: Alan Silver |
last post by:
Hello,
I have a custom control that displays the date and time. I currently
have properties for the day, month, year, hour and minute, which have to
be set separately. This is inefficient.
I...
|
by: I am Sam |
last post by:
I have created this DateTime object and instanced it I think correctly
DateTime myClubNow1=new...
|
by: Phil B |
last post by:
I am having a problem with a datetime from a web services provider
The provider is sending the following SOAP response
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope...
|
by: pranesh.nayak |
last post by:
I'm facing an error:"String was not recognized as a valid DateTime"
whille accessing DateTime from webservice.
And when I try to set DateTime to the same webservice it fails with
error:"Date...
|
by: JFieseler |
last post by:
Hi all,
in a huge project i have the following problem.
I create an object which contains many private members (i know that this is
not correct, but it is a single use migration program). The...
|
by: iulian.ilea |
last post by:
Is correct to have a varchar field and insert dates of type dd/mm/yyyy
into it? I choose this method because I have an application that runs
on more than one server. So, if I used a datetime field...
|
by: =?Utf-8?B?QmFidU1hbg==?= |
last post by:
Hi,
I have a GridView and a SqlDataSource controls on a page. The SqlDataSource
object uses stored procedures to do the CRUD operations. The DataSource has
three columns one of which -...
|
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= |
last post by:
Hi
I am having a problem formatting a string when the time is in format
hh.mm.ss - used in Europe
Parse seems ok when the date uses "/" or "." as seperator
but I get an exception when time...
|
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: 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: 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: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |