首页 > 数据库 > Oracle > 正文

用BCB编写一个改写oracle日期显示格式的程序

2024-08-29 13:39:03
字体:
来源:转载
供稿:网友

  #include
  #PRagma hdrstop
  #include
  #include "Unit1.h"
  //---------------------------------------------------------------------------
  #pragma package(smart_init)
  #pragma resource "*.dfm"
  TForm1 *Form1;
  //---------------------------------------------------------------------------
  __fastcall TForm1::TForm1(TComponent* Owner)
   : TForm(Owner)
  {
  }
  //---------------------------------------------------------------------------
  
  void __fastcall TForm1::Button1Click(TObject *Sender)
  {
  //读注册表
  TRegistry *RegLiveFpcnR = new TRegistry;
   try
   {
   RegLiveFpcnR->RootKey = HKEY_LOCAL_MACHINE;
   if(RegLiveFpcnR->OpenKey("//SOFTWARE//Oracle",true) != false)
   CSpinEdit1->Text = RegLiveFpcnR->ReadString("NLS_DATE_FORMAT");
   }
   __finally
   {
   RegLiveFpcnR->CloseKey();
   delete RegLiveFpcnR;
   }
  }
  //---------------------------------------------------------------------------
  
  void __fastcall TForm1::Button2Click(TObject *Sender)
  {
  //写注册表
  TRegistry *RegLiveFpcnW = new TRegistry;
   try
   {
   RegLiveFpcnW->RootKey = HKEY_LOCAL_MACHINE;
   if(RegLiveFpcnW->OpenKey("//SOFTWARE//ORACLE",true) != false)
   RegLiveFpcnW->WriteString("NLS_DATE_FORMAT",Trim(CSpinEdit2->Text.c_str()));
   ShowMessage("日期格式设置成功!");
   }
   __finally
   {
   RegLiveFpcnW->CloseKey();
   delete RegLiveFpcnW;
  }
  }
  //---------------------------------------------------------------------------
  void __fastcall TForm1::FormShow(TObject *Sender)
  {
  CSpinEdit2->Items->Add("YYYY-MM-DD");
  CSpinEdit2->Items->Add("YYYY/MM/DD");
  CSpinEdit2->Items->Add("MM-DD-YYYY");
  CSpinEdit2->Items->Add("MM/DD/YYYY");
  CSpinEdit2->Items->Add("MM-DD-YY");
  CSpinEdit2->Items->Add("MM/DD/YY");
  CSpinEdit2->Items->Add("DD-MM-YYYY");
  CSpinEdit2->Items->Add("DD/MM/YYYY");
  CSpinEdit2->Items->Add("DD-MM-YY");
  CSpinEdit2->Items->Add("DD/MM/YY");
  Label3->Caption="本程序是针对Oracle日期格式更改而设计的,/n设计环境:Windows98/Oracle7 /n适用于客户端和单机版用户。建立或修改注册表键值:";
  }
  //---------------------------------------------------------------------------

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表