I previously posted this question under Visual Basic
newsgroup, but was advised to re-post here.
I'm hoping someone can help me solve an issue I'm having
with VB.Net and Access 2000.
Here's the issue. I hope I've included all relevant
information.
On a form, I have a DateTimePicker with the following
settings:
CustomFormat- HH:mm (to allow 24-hour clock)
ShowUpDown- True
I'm trying to have the user input a time. Once the time
has been input, I store the value in a Date variable.
I then try to insert the Time portion of that Date into a
Access 2000 DB, using a DataAdapter. The problem I'm
having is I can't seem to get the proper format to have
the time saved correctly. No matter what I'v tried, I
keep getting 00:00 in the time field.
The Time field in the DB is of type Short Time, with an
Input Mask of 99:99.
I've tried the following to save the data into the DB:
The line to input the value is:
Me.PlannedActivitiesDataAdapter.InsertCommand.Para meters.It
em("finishTime").Value =
I've tried the following to properly save the time, but
have no found one that works. The variable fTime is of
type Date and IS storing the time portion correctly, but I
can't seem to get it out of the variable to save it in the
DB.
fTime
"#" & fTime & "#"
FormatDateTime(fTime, DateFormat.LongTime)
"#" & FormatDateTime(fTime, DateFormat.LongTime) & "#"
FormatDateTime(fTime, DateFormat.ShortTime)
"#" & FormatDateTime(fTime, DateFormat.ShortTime) & "#"
FormatDateTime(fTime, 4)
FormatDateTime(fTime, 2)
I've tried inserting a Date variable into the DB, but the
time portion does not get stored (seems to default to
00:00). The Date/Time retrieved from the DateTimePicker
has the correct date and time, but it won't store it in
the DB correctly, and this is where I'm getting the error.
Also, if anyone knows how to hardcode a time and place it
in the DB, that would help too! I can worry about parsing
the time from the date later. I just can't seem to find
the format I'm supposed to use for Access 2000.
Also, if changing the datatype of the field in the DB to
something other than ShortTime will solve the problem, I'd
like to know. As long as the time gets stored somehow!
I hope that's clear enough. Any help would be greatly
appreciated! I'm at my wits end!
Thanks,
Jay 3 7808
Hi Jim,
Thanks for the response. I've checked my code, and I
believe I'm already doing that, if somewhat differently.
I'm only INSERTing, thankfully there are no updates.
Here's the code (generated by the DataAdapter):
Me.OleDbInsertCommand12.CommandText = "INSERT INTO
ActivitiesList(finishTime) VALUES (?)"
Me.OleDbInsertCommand12.Parameters.Add(New
System.Data.OleDb.OleDbParameter("finishTime",
System.Data.OleDb.OleDbType.DBDate, 0, "finishTime"))
Me.ActivitiesDataAdapter.InsertCommand.Parameters. Item
("finishTime").Value = "12:30"
Even coded like that, the time is displayed as 00:00
If you have any other suggestions, I'm definitely willing
to try them!
Thanks again,
Jay -----Original Message----- Hi Jay,
It should go something like this.......
me.oleDbUpdateCommand1.CommandText = "UPDATE Stories SET ProdDate = ?"
me.oleDbUpdateCommand1.Parameters.Add("ProdDate ", System.Data.OleDb.OleDbType.DBDate, 0, "ProdDate")
me.oleDbUpdateCommand1.Parameters("ProdDate").Val ue = "12:30"
You need to define your parameter more specifically and once that's done a String will be converted to the database type properly.
-----Original Message----- I previously posted this question under Visual Basic newsgroup, but was advised to re-post here.
I'm hoping someone can help me solve an issue I'm having with VB.Net and Access 2000.
Here's the issue. I hope I've included all relevant information.
On a form, I have a DateTimePicker with the following settings: CustomFormat- HH:mm (to allow 24-hour clock) ShowUpDown- True
I'm trying to have the user input a time. Once the time has been input, I store the value in a Date variable.
I then try to insert the Time portion of that Date into
aAccess 2000 DB, using a DataAdapter. The problem I'm having is I can't seem to get the proper format to have the time saved correctly. No matter what I'v tried, I keep getting 00:00 in the time field.
The Time field in the DB is of type Short Time, with an Input Mask of 99:99.
I've tried the following to save the data into the DB:
The line to input the value is: Me.PlannedActivitiesDataAdapter.InsertCommand.Pa rameters.
Item("finishTime").Value =
I've tried the following to properly save the time, but have no found one that works. The variable fTime is of type Date and IS storing the time portion correctly, but Ican't seem to get it out of the variable to save it in theDB.
fTime "#" & fTime & "#" FormatDateTime(fTime, DateFormat.LongTime) "#" & FormatDateTime(fTime, DateFormat.LongTime) & "#" FormatDateTime(fTime, DateFormat.ShortTime) "#" & FormatDateTime(fTime, DateFormat.ShortTime) & "#" FormatDateTime(fTime, 4) FormatDateTime(fTime, 2)
I've tried inserting a Date variable into the DB, but
thetime portion does not get stored (seems to default to 00:00). The Date/Time retrieved from the DateTimePicker has the correct date and time, but it won't store it in the DB correctly, and this is where I'm getting the
error. Also, if anyone knows how to hardcode a time and place
itin the DB, that would help too! I can worry about parsingthe time from the date later. I just can't seem to find the format I'm supposed to use for Access 2000.
Also, if changing the datatype of the field in the DB to something other than ShortTime will solve the problem, I'dlike to know. As long as the time gets stored somehow!
I hope that's clear enough. Any help would be greatly appreciated! I'm at my wits end!
Thanks, Jay
. .
Here is a simple asp.net example, I don't know if it will help at all.
dim conn as OleDBConnection = new
OleDBConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data
Source=yourpath\file\dbnamehere")
Dim dbCommand as OleDBCommand
dim strsql as string
dim myTime as datetime = timevalue("10:30")
strsql = "Insert into tblTime (fldtime) Select #" & ctype(myTime,string) &
"# as fldtime;"
dbCommand=New OleDBCommand(strSql, conn)
Dim dbComm as OleDbDataAdapter = New OleDbDataAdapter
dbComm.SelectCommand = dbCommand
dbCommand.Connection.Open()
dbCommand.ExecuteNonQuery()
dbCommand=nothing
conn.dispose()
"Jay" <ru***********@bigfoot.com> wrote in message
news:84****************************@phx.gbl... I previously posted this question under Visual Basic newsgroup, but was advised to re-post here.
I'm hoping someone can help me solve an issue I'm having with VB.Net and Access 2000.
Here's the issue. I hope I've included all relevant information.
On a form, I have a DateTimePicker with the following settings: CustomFormat- HH:mm (to allow 24-hour clock) ShowUpDown- True
I'm trying to have the user input a time. Once the time has been input, I store the value in a Date variable.
I then try to insert the Time portion of that Date into a Access 2000 DB, using a DataAdapter. The problem I'm having is I can't seem to get the proper format to have the time saved correctly. No matter what I'v tried, I keep getting 00:00 in the time field.
The Time field in the DB is of type Short Time, with an Input Mask of 99:99.
I've tried the following to save the data into the DB:
The line to input the value is: Me.PlannedActivitiesDataAdapter.InsertCommand.Para meters.It em("finishTime").Value =
I've tried the following to properly save the time, but have no found one that works. The variable fTime is of type Date and IS storing the time portion correctly, but I can't seem to get it out of the variable to save it in the DB.
fTime "#" & fTime & "#" FormatDateTime(fTime, DateFormat.LongTime) "#" & FormatDateTime(fTime, DateFormat.LongTime) & "#" FormatDateTime(fTime, DateFormat.ShortTime) "#" & FormatDateTime(fTime, DateFormat.ShortTime) & "#" FormatDateTime(fTime, 4) FormatDateTime(fTime, 2)
I've tried inserting a Date variable into the DB, but the time portion does not get stored (seems to default to 00:00). The Date/Time retrieved from the DateTimePicker has the correct date and time, but it won't store it in the DB correctly, and this is where I'm getting the error.
Also, if anyone knows how to hardcode a time and place it in the DB, that would help too! I can worry about parsing the time from the date later. I just can't seem to find the format I'm supposed to use for Access 2000.
Also, if changing the datatype of the field in the DB to something other than ShortTime will solve the problem, I'd like to know. As long as the time gets stored somehow!
I hope that's clear enough. Any help would be greatly appreciated! I'm at my wits end!
Thanks, Jay
Jay,
I was having the same problem. I changed the
System.Data.OleDb.OleDbType.DBDate to
System.Data.OleDb.OleDbType.DBTimeStamp and it worked!
....Steve -----Original Message----- Hi Jim,
Thanks for the response. I've checked my code, and I believe I'm already doing that, if somewhat differently. I'm only INSERTing, thankfully there are no updates.
Here's the code (generated by the DataAdapter):
Me.OleDbInsertCommand12.CommandText = "INSERT INTO ActivitiesList(finishTime) VALUES (?)"
Me.OleDbInsertCommand12.Parameters.Add(New System.Data.OleDb.OleDbParameter("finishTime", System.Data.OleDb.OleDbType.DBDate, 0, "finishTime"))
Me.ActivitiesDataAdapter.InsertCommand.Parameters .Item ("finishTime").Value = "12:30"
Even coded like that, the time is displayed as 00:00
If you have any other suggestions, I'm definitely willing to try them!
Thanks again, Jay
-----Original Message----- Hi Jay,
It should go something like this.......
me.oleDbUpdateCommand1.CommandText = "UPDATE Stories SET ProdDate = ?"
me.oleDbUpdateCommand1.Parameters.Add("ProdDate" , System.Data.OleDb.OleDbType.DBDate, 0, "ProdDate")
me.oleDbUpdateCommand1.Parameters("ProdDate").Va lue = "12:30"
You need to define your parameter more specifically and once that's done a String will be converted to the database type properly.
-----Original Message----- I previously posted this question under Visual Basic newsgroup, but was advised to re-post here.
I'm hoping someone can help me solve an issue I'm
havingwith VB.Net and Access 2000.
Here's the issue. I hope I've included all relevant information.
On a form, I have a DateTimePicker with the following settings: CustomFormat- HH:mm (to allow 24-hour clock) ShowUpDown- True
I'm trying to have the user input a time. Once the
timehas been input, I store the value in a Date variable.
I then try to insert the Time portion of that Date intoaAccess 2000 DB, using a DataAdapter. The problem I'm having is I can't seem to get the proper format to have the time saved correctly. No matter what I'v tried, I keep getting 00:00 in the time field.
The Time field in the DB is of type Short Time, with an Input Mask of 99:99.
I've tried the following to save the data into the DB:
The line to input the value is: Me.PlannedActivitiesDataAdapter.InsertCommand.P arameters
..Item("finishTime").Value =
I've tried the following to properly save the time, but have no found one that works. The variable fTime is of type Date and IS storing the time portion correctly,
butIcan't seem to get it out of the variable to save it in theDB.
fTime "#" & fTime & "#" FormatDateTime(fTime, DateFormat.LongTime) "#" & FormatDateTime(fTime, DateFormat.LongTime) & "#" FormatDateTime(fTime, DateFormat.ShortTime) "#" & FormatDateTime(fTime, DateFormat.ShortTime) & "#" FormatDateTime(fTime, 4) FormatDateTime(fTime, 2)
I've tried inserting a Date variable into the DB, but thetime portion does not get stored (seems to default to 00:00). The Date/Time retrieved from the
DateTimePickerhas the correct date and time, but it won't store it in the DB correctly, and this is where I'm getting the error. Also, if anyone knows how to hardcode a time and placeitin the DB, that would help too! I can worry about parsingthe time from the date later. I just can't seem to
findthe format I'm supposed to use for Access 2000.
Also, if changing the datatype of the field in the DB
tosomething other than ShortTime will solve the problem, I'dlike to know. As long as the time gets stored somehow!
I hope that's clear enough. Any help would be greatly appreciated! I'm at my wits end!
Thanks, Jay
. . . This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Dave |
last post by:
After following Microsofts admonition to reformat my system before doing a
final compilation of my app I got many warnings/errors upon compiling an rtf
file created in word. I used the Help...
|
by: Tom |
last post by:
A question for gui application programmers. . .
I 've got some GUI programs, written in Python/wxPython, and I've got
a help button and a help menu item. Also, I've got a compiled file
made with...
|
by: Sarir Khamsi |
last post by:
Is there a way to get help the way you get it from the Python
interpreter (eg, 'help(dir)' gives help on the 'dir' command) in the
module cmd.Cmd? I know how to add commands and help text to...
|
by: Sudheer Kareem |
last post by:
Dear All
Please tell me how to assosiate help files with my Vb.net
Project.
Regards
Sudheer
|
by: wukexin |
last post by:
Help me, good men. I find mang books that introduce bit "mang header
files",they talk too bit,in fact it is my too fool, I don't learn it, I have
do a test program, but I have no correct doing...
|
by: Colin J. Williams |
last post by:
Python advertises some basic service:
C:\Python24>python
Python 2.4.1 (#65, Mar 30 2005, 09:13:57) on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
With...
|
by: Steve |
last post by:
I have written a help file (chm) for a DLL and referenced it using Help.ShowHelp
My expectation is that a developer using my DLL would be able to access this help file during his development time...
|
by: Fred Flintstone |
last post by:
This one baffles me. I'm using VS.Net 2005 and write desktop apps
that need built in help. So logically, I figure maybe VS has a help
system component built in so I search the help.
Hey! ...
|
by: trunxnirvana007 |
last post by:
'UPGRADE_WARNING: Array has a new behavior. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"'
'UPGRADE_WARNING: Couldn't resolve...
|
by: hitencontractor |
last post by:
I am working on .NET Version 2003 making an SDI application that calls MS Excel 2003.
I added a menu item called "MyApp Help" in the end of the menu bar to show Help-> About.
The application...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
|
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...
| |