|
-
Oct 17th, 2002, 05:02 PM
#1
Thread Starter
Frenzied Member
Problem with datasets updating time fields
Hi ppl,
I am really tired of posting this problem here and there
without any solution for it.
In a simple VB.NET application i used an oledbdataadapter to connect to an access database containing of only one table with 2 fields, one auto number filed and one Date/Time field, and passed the data from a textbox to the database. No matter what time i insert to the text box, always 0:00 is stored in the
database. I use Jet4 SP6, DOTNETFX SP2, and ACCESS 2002
SP2,WinXP Pro and the database is in access 2002 format. I tried to test various Date/Time formats such as short time, long time, general date ...,and various change type CTYPE, CDATE... still no success. The code i used is :
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Dim dtrow As DataRow
dtrow = DataSet11.tb1.NewRow
dtrow(0) = CDate(TextBox1.Text)
DataSet11.tb1.Rows.Add(dtrow)
Ole1.Update(DataSet11.tb1)
End Sub
at dataset level everything is fine, that is if i populate
a datagrid from the dataset before updating the database
and refilling the dataset from it, its ok. I have found
out that if i change the automatically build insert
command and just put a value instead of the parameter it
will work fine, however when i check the parameter value
of the insertcommand it just has the value i passed to it
so the problem can not be the parameter itself. I dont
know what goes wrong with the transactions of the dataset
and the database in this situation.
Please help me
-
Oct 18th, 2002, 02:15 PM
#2
What datatype is the database field? What is some sample text for the Textbox?
-
Oct 18th, 2002, 02:42 PM
#3
Thread Starter
Frenzied Member
The database field is Date/Time, and I have tested the various formats for it, that is Short,long, medium Time and General Date. And the text i insert in text box is for example 12:45 or 10:34 PM and i used CDATE and also CTYPE(textbox1.text, DateTime). I am sure that the text is properly changed to Time format cause when i check the dataset its ok.
-
Oct 18th, 2002, 07:28 PM
#4
Ok I'm going to try to recreate the problem, are you using a Typed Dataset or no?
-
Oct 18th, 2002, 09:44 PM
#5
Hmm well I don't know man, I see how that can bug the crap out of ya. I'm not sure if it is some kind of bug or what but it didn't like anything I tried either. Sorry, maybe later I'll search the net a bit to see if there is a fix.
-
Oct 19th, 2002, 12:26 AM
#6
Thread Starter
Frenzied Member
Thanks for your help Edneeis!
The dataset was typed one, still i am looking for a solution but guess I have to give up, its months i am searching for a soultion. I think I am going to change the time to 'seconds from midnight' and store it in a 'number' field. and then reformat it while showing the data.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|