Experience in C++, C#, Java and Process : Living in Montreal

* What is my technical experience as a software developer

* What I have learned in the software business

* Where I am heading to in my career

* How to process in a project

Tuesday, January 25, 2005

Data access in VS.NET demo : C#

1. http://www.dotnetjunkies.com/Tutorial/92FD33CA-7528-42A0-B974-8607A04B8B56.dcik
2. Introduction
When using the Visual Studio.NET IDE to create connections to MS Access databases, the default wrapper only puts Dates into Date/Time fields. This causes only the date to be saved and on the time when a date/time is written to the data set and Update is called.
How to fix it?
1) This is caused by the Wizard using DBDate rather than DBTimeStamp in the OleDbParameter method generated by the wizard. Ofcourse each time you regenerate this code using the wizard you will have to do the replace again.
Note: This has to be done in all OleDbParameter calls that use System.Data.OleDb.OleDbType.DBDate and replace with System.Data.OleDb.OleDbType.DBTimeStamp

Actually, this solution does not work. INSERT causes an error about type mismatch
2) Just change to System.Data.OleDb.OleDbType.Date and it will work.

3. Don't use 'Level' as a row name in a table, VS.NET IDE will not generate data adapter for it.

4. Expend the width of a column
int nWidth = objColumnStylegrdLogTableEvent_Level.Width+objColumnStylegrdLogTableInfo.Width + objColumnStylegrdLogTableTime.Width;
objColumnStylegrdLogTableInfo.Width = grdLogTable.Width - nWidth;

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home