الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

SQL SERVER والتاريخ الهجري

مغلق
بدأه زائر في 1 مايو 2001 · 10 رد · 9,396 مشاهدة · في أرشيف قسم SQL Server
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

صممت قاعدة بيانات بـsql server وبها حقل تاريخ من نوع datetime واجهة البرنامج بالفيجوال بيسك عند وضع التاريخ الهجري يقبله الفيجوال بيسك اثناء الكتابة بينما يحوله الاس كيو ال سيرفر الى ما يقابله من التاريخ الميلادي

جربت هل سيقومم بتحويله مرة اخرى الى الهجري عند استرجاع القيمة فلم يفعل ذلك

علما انني من قبل جعلت هذا الحقل من نوع varchar لحل هذه المشكلة لكنني لم استطع استرجاع حقول شهر معين منها

هل من حل لديكم

الاستاذ خضر ترزي وجميع الاحوان تقبلوا تحياتي

#2

اخي الكريم انا صراحة لم اتعامل يوما مع التاريخ الهجري للاسف الشديد و ذلك لاننا لا نستخدمه في المنطقة التي اعيش فيها

ولكن طبيعي ان يتحول التاريخ الى ميلادي في الجهاز المركزي ، فالتاريخ تاريخ لا يهم كان هجري او ميلادي ، كل ما عليك هو ان تطلب من النظام بان يعرضه للمستخدم على شكل تاريخ هجري و يتوقع من المستخدم بان يدخل التالريخ بصورة تاريخ هجري و اعتقد بان عرضه يتم بتعديل في الاعدادات الاقليمية في لوحة التحكو و ربما في خصائص ال text box في access اعتقد بانه تسمى format

المشكلة انني لم اتعامل مع التواريخ الهجرية من قبل

تخزين تاريخ على انه نص خطاء فادح لانك تقفد امكانية ترتيب السجلات و البحث فيها بواسطة التاريخ و فرزها ايضا

#3

اخي العزيز الاستاذ خضر

اشكرك على تجاوبك معي

فعلت كل ما اشرت اليه ومع هذا يظهر لدي التاريخ في الفيجوال بيسك بالهجري وفي sql server يحوله الى ما يقابله بالميلادي جربت حين استرجاع التاريخ ان ارجعه الى قيمته الهجرية فلم افلح

المشكلة ان نطاق التاريخ الميلادي الذي يدعمه sql server لا يمكنه قبول السنوات الهجرية الحالية

بحثت في ملفات المساعدة لـsql server فلم اجد ذكرا للتاريخ الهجري

هل بامكانك يا استاذ خضر ان تستفسر من ميكروسوفت عن ذلك

لان الدوائر الحكومية لبعض الدول العربية لا تعمل الا على التاريخ الهجري

بالنسبة لوضع التاريخ في حقل من نوع نص لعل ذلك حلا مؤقتا لكن عند تغيير نوعه بواسطة cast او convert يرجع رسالة خطأ ان التاريخ خارج النطاق لكن لاحظت في احد المرات الن البرنامج اقترح علي تغيير اللغة لا ادري اي لغة هل هي لغة اعداد sql server الخاصة بالترميز انا اخترت العربية

على العموم خلينا نحاول حتى نصل لحل ان شاء الله

شكرا لك

#4

اليك خطوات لبناء برنامج يدعم التواريخ الهجرية بواسطة Microsoft Access من مايكروسوفت مع حل مشكلة الفلترة في هذه التواريخ و يمكن تطبيقه على ال SQL Server ايضا و لكن من داخل ال Access فقط

Click

Start, point to Settings, and then click Control Panel.

In Control

Panel, double-click Regional Settings.

In the

Regional Settings Properties dialog box, click the Date tab, and

click dd/mm/yy in the Short date style list.

Start Access

and open any database.

On the

Tools menu, click Startup.

In the

Startup dialog box, click Advanced, and click to select the Use

Hijri Calendar check box to set the database calendar to Hijri.

Create a new

table with a Date/Time field and name the field "mydate".

Enter a few

date values in the Date field (for example enter values from 2/1/18 to

2/8/18).

Create a

form based on the new table and add the "mydate" field to the form.

Set the

Filter property of the form to [mydate]>#2/4/18#.

View the

form in Form view and click the Apply Filter button on the toolbar.

Note that no

results are returned. You would expected to see all records from 2/5/18 to

2/8/18.

To get the correct results, set the Filter property to [mydate]>CDATE("2/4/18").

#5

معلومات اخرى عن التواريخ الهجرية

Arabic Access contains support for

both the Hijri and Gregorian calendars. The following paragraphs describe usage

tips and documentation updates that supersede information found in the Database

Calendar topic of the Arabic Features Supplement Manual and Arabic Features

online help.

The Gregorian calendar is the default

calendar for all databases created or opened in Arabic Access. To see or change

the calendar setting for a particular database, click Startup on the Tools menu,

and then click the Advanced button on the Startup dialog.

To set the calendar for the currently

open database to Hijri, check the Hijri Calendar checkbox in the Advanced

portion of the dialog. The setting is saved with the database and used for all

date references in the database.

If an existing database with date

references is opened and the wrong calendar setting has been selected, Arabic

Access may report a variety of errors or other unexpected behaviors. For

example, if the Hijri Calendar setting is checked, Access will display a syntax

error message if a report makes reference to Gregorian dates that are invalid as

Hijri dates (e.g., 12/31/93 because no Hijri month has 31 days).

To avoid problems of this sort, all

date references in a database should be based on the same calendar.

Consequently, it is recommended that the database calendar be chosen when a

database is first created and then never changed.

To ensure Hijri dates strings are

evaluated correctly in Access expressions and VBA statements, use the CDate

function to evaluate the string (e.g., CDate("1/25/14")) instead of declaring

the string as a constant (e.g., #1/25/14#). CDate will always return a value

based on the active database calendar, whereas date constants are always

evaluated using the Gregorian calendar.

For reliable behavior, dates should

generally be entered and displayed in an unambiguous format. For example, dates

entered in short date format may be misinterpreted in queries if the year or the

day of the month are 12 or less (e.g. 3/11/10). Dates in medium date format

display only the first few characters of the month name which can create

ambiguity or undesirable appearance. For reliable behavior, use long date format

whenever possible. You can alter the way a date is displayed in long format

(e.g. exclude the day of the month) by changing the format in the Windows 95

Regional Settings Control Panel.

#6

Arabic Access

Basic Tips, Tricks and Traps

space.gif

Article last modified on 01-22-1997

The information in this article applies to:

 

Arabic Access 7.0

Arabic Windows 95

Installing Arabic

Windows 95 Before Arabic Access

Arabic Microsoft Windows 95 must be installed prior to installing Arabic Access.

Refer to the Installing Arabic Access topic in Part 1-Getting Started of the

Arabic Features Supplement manual for full installation instructions.

Setup User Interface

Language

The Setup user interface language is English. Statements in the Arabic Features

Supplement manual or other documentation that indicate the Setup user interface

language may be set to either English or Arabic are incorrect.

Installing from

Arabic Microsoft Office Professional CD

There are separate setup programs for Arabic Microsoft Office 95 and Arabic

Microsoft Access 95. To install a particular product, run the SETUP.EXE program

in the appropriate product folder.

The product folders for Arabic Office

95 and Arabic Access 95 are Office and Access, respectively. The order in

which you choose to install is insignificant.

Workstation

Installation

The switchable user interface language feature is not supported with a

Workstation installation, and will potentially cause problems. If you need to

have a switchable user interface language, you must reinstall Access using a

different installation configuration.

Installing Arabic

Access on U.S. Windows 95

Arabic Access can be installed and run on U.S. Windows 95 but several

significant limitations exist when this is done. Because of these limitations,

installation on U.S. Windows 95 is generally not advised.

Foremost, it is not possible to enter

and display Arabic text.

In addition, Wizards will not work.

This affects not only visible wizards but also wizards than run in the

background when certain functionality are invoked (e.g., Import and Export of

files).

Installation on

Windows NT not supported

Installation of Arabic Access 95 requires Microsoft Arabic Windows 95 or later

version. Please disregard any references to operation on Windows NT 3.51 in the

documentation.

Words Ignored by

Spell-checkers

The Arabic spell-checker ignores English words during spell checking, so they

are not flagged as misspelled words. However, the English spell-checker

(American or British) does not ignore Arabic words when performing spell

checking.

Printing

Multiple-Column Reports and Labels

Reports and labels can be printed in a multiple-column format by specifying the

number of columns in the Items Across setting on the Layout tab of the dialog

box for the File menu Page Setup command. The layout of columns will always be

from left-to-right regardless of the Orientation of the report.

Expression Builder

Limitations

Access allows expressions to be entered and edited directly in the Properties

window of controls or by using Expression Builder. Editing and layout of mixed

Arabic and English text is fully supported in the Properties window and is the

recommended way of entering mixed text expressions. Expression Builder is not

enabled to support editing and layout of mixed Arabic and English text, so the

appearance of mixed text in Expression Builder may be confusing. However,

expressions entered with Expression Builder will be correctly transferred to the

Properties window.

Displaying Arabic

Text in MSGraph objects

The default font for MSGraph objects

does not support Arabic text. To display Arabic text, double-click the MSGraph

object in design view and manually set the font for each item to a Arabic font.

GetOption/SetOption

Values for Interface Language

When using the VBA GetOption and SetOption methods to return and set the

Interface Language option item in the Arabic tab of the Tools/Options dialog

box, the Interface Language settings and values are:

Setting Value

English 0

Arabic 1

A runtime error message is displayed

if SetOption is called with values other than 0 or 1. The runtime error message

incorrectly states that 0 - 3 are allowed values.

Exporting

Right-to-left Tables

Arabic Access tables that have

Right-to-left Orientation can be exported to Microsoft Excel. However, when the

table is opened as a spreadsheet in Microsoft Excel or Arabic Excel the table

orientation will be Left-to-right.

Arabic Access tables that have

Right-to-left Orientation can also be exported to Microsoft Word. When the table

is opened in Microsoft Word, table orientation will be Left-to-right. When the

table is opened in Arabic Word, table orientation will be Right-to-left but cell

text alignment will be inherited from the active document template in Word.

Diacritics are not

ignored in Find & Replace

The Find and Replace commands do not

ignore diacritics in text. To find words that include diacritics, the search

argument must include any diacritics that are present.

Viewing Property

Sheets of Custom Controls

Custom controls (also known as OCX

controls) are available from Microsoft and other software companies. One custom

control, the Calendar control, is distributed with Arabic Access.

When the Access user interface

language is Arabic, there are two factors to consider when viewing the property

sheet of a custom control:

Names for standard properties known

to Arabic Access will be in Arabic. Names for custom control properties that

are not known to Arabic Access will be in the language used by the custom

control developer, typically English.

 

Property names in English will be

visible on the custom control property sheet only if the General Alignment

preference in Tools/Options is set to Text Mode. If General Alignment is set

to Interface Mode, a series of dot characters will be displayed in the

property name display area.

Partially Visible

Arabic Text

The first (rightmost) character of certain right-aligned Arabic text strings is

only partially visible when displayed. This occurs when the first character is

wider-than-average for the font chosen and the font point size is greater than

10 point. To view the first character completely, it may be necessary to enter a

blank character before the rightmost character.

Filter By Form and

Hijri Dates

The Filter by Form and Filter by

Selection commands available on the Toolbar and Records/Filter menu may give

inaccurate results when the Hijri calendar has been chosen. For this reason, it

is strongly recommended that these functions not be used when the database

calendar is Hijri. All other query facilities, including all standard query

capabilities accessible via Queries objects and the Advanced Filter/Sort command

on the Records/Filter menu are available as alternatives to the Filter by Form

and Filter by Selection commands.

Numeral Shapes

property not available

Numeral Shapes property is missing from

the property sheet for Listbox and Label controls.

This property is present in the

property sheet for Combo boxes but it only applies to the edit box portion and

has no effect on the listbox portion of the control.

Updates to Arabic

Features help

Arabic Features help, the online

version of the Arabic Features Supplement manual, is normally more up to date

than the manual due to the ability to make changes to Arabic Features help later

in the product development cycle. Where differences exist, the information given

in Arabic Features help is generally more accurate.

#7

جرب ايضا هذين الامرين ، احتمال ان يعملا جيدا في بيزك ولكني لست متاكد

How to Change the Calendar Type (Hijri, Georgian)

To Change to Hijri

Application.SetOption "calendar" ,0

To Change to Georgian

Application.SetOption "calendar" ,1

#9

شكرا استاذ خضر

غرقتني في بحر من المعلومات

الحل المؤقت الذي عملته هو وضع التاريخ في حقل نص (مع ان ذلك خطأ) واستدعاء الشهر او اليوم او السنة بواسطة substring

ان شاء الله اجد الحل في المعلومات السابقة

اكرر شكري

#10

حل مجرب وأكيد

أولا :

عرف ال CALENDAR داخل ال VB على انها هجري

CALENDAR=1

ثانيا :

انشئ متغير من النوع التاريخي

DIM BASEDATE AS DATE

BASEDATE = #1/1/1400#

ثالثا :

انشئء داله لتعيد اليك رقم صحيح اذا مررت اليها أي تاريخ هجري

هذا الرقم الصحيح يكون عباره عن عدد الأيام الفرق بين التاريخ المراد حفظه في قاعدة البيانات والتاريخ BASEDATE وذلك باستخدام DATEDIFF

رابعا :

في قاعدة البيانات غير النوع من DATETIME الى (NVARCHAR(10

ثم اضف حقلا آخر من النوع INTEGER

وعند الإضافة أو التعديل مرر التاريخ المراد حفظه الى الداله لتعيد اليك عدد الأيام . ثم احفظه في الحقل INTEGER واحفظ التاريخ كنص في الحقل NVARCHAR

وعند الإستعلام عن تاريخ مرره الى الداله لتعيد اليك الرقم الصحيح الذي ستبحث عنه في قاعدة البيانات

ملحوظة : انا استخدم هذه الطريقة غي كل برامجي

ارجوا الإفاده

#11

اقل قيمة تاريخية يقبلها sqlserver هي سنة 1750 بينما التاريخ الهجري(على افتراض السنةالحالية) 1423

وبتالي يأتي هذا الخطأ

اعتقد ان ميكروسوفت لديها حل لهذه المشكلة.

هذا الموضوع مغلق.

مواضيع مشابهة