|
Website Menu
|
|
|
|
Oracle Data Access Generator for .net
|
|
Category:
Sample Programs
|
|
“Oracle Data Access Generator” is a simple to use tool to generate C# codes to connect an ASP.net application to Oracle Database. Generated code contains procedures to Select, Insert, Update and Delete data that can be used in an ObjectDataSource in order to bind controls like: GridView, FormView, DropDownList, etc. Queries and Parameters could be customized during generation steps.
This tool is a facility to make a standard and uniform data access layer. For a correct and effective usage a basic knowledge of C# programming and Oracle SQL Queries is needed.
I made this tool once in May 2007 for an application that uses ASP.net 2.0 and Oracle 10g. After the experience of some successful applications, this tool is improved and updated.
- Generated codes are very simple and understandable.
- Good runtime performance and low processing overhead.
- Using this tool is very fast and simple.
- Useful to make a standard and uniform data access layer.
- Using this tool cause prevents from human mistakes.
- Result can be used in order to bind controls like: GridView, FormView, DropDownList, etc.
In order to run the generator or generated codes you need to set up Oracle Provider for .net (ODP.net / ODT.net) that is available in Oracle official website.
Application is ready to free download.
C# Source Code is available for download, but please send your request and bug reports to me that caused to new version be published for all.
For more support contact me using support@nickmehr.net.
|
|
|
|
|
|
|
Customized Persian Date Display
|
|
Category:
Public Topics
|
|
As I mentioned in “Using format string with a flexible date and time display in C#.net” .net framework provides some methods to display DateTime values and the best way is using string formats. When we are using Persian Dates in PersianDateControls Library we can use string formats just like Georgian dates in PersianDateLable control. There are two ways for changing date format in this control:
Setting DateFormat property, these date formats are some popular predefined string formats:
DateFormat.None //--> "{0:yyyy/MM/dd}";
DateFormat.Default //--> "{0:dd MMMM yyyy}";
DateFormat.LongDate //--> "{0:dddd dd MMMM yyyy}";
DateFormat.LongTime //--> "{0:hh:mm:ss.ffff tt}";
DateFormat.ShortDate //--> "{0:dd MMMM yy}";
DateFormat.ShortTime //--> “{0:HH:mm:ss}";
DateFormat.FullDateTime //--> "{0:hh:mm:ss.ffff tt dddd dd MMMM yyyy}";

Setting FormatString property, this string supports any format that is supported by Georgian dates as it is shown in the example below:
PersianDateLable.FormatString = "{0:yy yyyy - M MMMM - d dddd}";
PersianDateLable.DateValue = new DateTime(2009, 2, 14, 22, 7, 36, 217);
Also you can use string formats to get customized Persian date for other usages by use:
PersianDateControls.Convertor.ToPersianDate(new DateTime(2009, 2, 14, 22, 7, 36, 217), "{0:dddd dd MMMM yyyy}");
|
|
|
|
|
|
|
Using format string to a flexible date and time display in C#.net
|
|
Category:
My Case Studies
|
|
Sometimes we want to display DateTime values in a special format. .net framework provides some methods to display DateTime values like:
DateTime datetime = new DateTime(2009, 2, 14, 22, 7, 36, 217);
datetime.ToLongDateString(); //--> Saturday, February 14, 2009
datetime.ToShortTimeString(); //--> 10:07 PM
By the way these methods are limited in format and you can make more customized formats using your own code for example:
public string GetSortableDate(DateTime datetime)
{
return string.Format("{0}/{1}/{2}", datetime.Year, datetime.Month.ToString("00"), datetime.Day.ToString("00")); //--> 2009/02/14
}
This solution is flexible and would return a DateTime value with any format but it needs some coding and each format needs a new method to be implemented. In my opinion the best solution is using Format String just like this sample:
datetime.ToString("yyyy/ MM/dd"); //--> 2009/02/14
or
string.Format("{0:yyyy/ MM/dd}", datetime); //--> 2009/02/14
This reference helps you use string formats:
String.Format("{0:y yy yyy yyyy}", datetime); //--> 9 09 009 2009 --> for display year
String.Format("{0:M MM MMM MMMM}", datetime); //--> 2 02 Feb February --> for display month
String.Format("{0:d dd ddd dddd}", datetime); //--> 14 14 Fri Friday --> for display day of month
String.Format("{0:h hh H HH}", datetime); //--> 10 10 22 22 --> for display 12/24 hour 1/2 digit
String.Format("{0:m mm}", datetime); //--> 7 07 --> for display minute 1/2 digit
String.Format("{0:s ss}", datetime); //--> 36 36 --> for display second 1/2 digit
String.Format("{0:f ff fff ffff}", datetime); //--> 1 12 123 1230 --> for display second fraction
String.Format("{0:F FF FFF FFFF}", datetime); //--> 1 12 123 123 --> for display second fraction without zeroes
String.Format("{0:t tt}", datetime); //--> P PM --> for display A.M. or P.M.
String.Format("{0:z zz zzz}", datetime); //--> +3 +03 +03:30 --> for display time zone
Also there are some fixed formats predefined in .net libraries like:
String.Format("{0:f}", datetime); //--> Saturday, February 14, 2009 10:07 PM
This reference helps you use string formats:
"{0:d}" //--> "{0:MM/dd/yyyy}"
"{0:D}" //--> "{0:MMMM dd, yyyy}"
"{0:f}" //--> "{0:dddd, MMMM dd, yyyy hh:mm}"
"{0:F}" //--> "{0:dddd, MMMM dd, yyyy HH:mm:ss tt}"
"{0:g}" //--> "{0:MM/dd/yyyy HH:mm}"
"{0:G}" //--> "{0:MM/dd/yyyy HH:mm:ss}"
"{0:M}" //--> "{0:MMMM dd}"
"{0:s}" //--> "{0:yyyy-MM-dd hh:mm:ss}"
"{0:t}" //--> "{0:hh:mm tt}"
"{0:T}" //--> "{0:hh:mm:ss tt}"

|
|
|
|
|
|