⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit1.cpp

📁 使用数据库管理图片-图片直接存入数据库。
💻 CPP
字号:
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#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)
{
ADOTable1->First();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button2Click(TObject *Sender)
{
ADOTable1->Prior();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button3Click(TObject *Sender)
{
ADOTable1->Next();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button4Click(TObject *Sender)
{
ADOTable1->Last();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button5Click(TObject *Sender)
{
ADOTable1->Insert();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button6Click(TObject *Sender)
{
if (! ADOTable1->Eof)
{
if ( Application->MessageBox("确认删除数据?", "注意", MB_YESNO) == IDYES)
{
ADOTable1->Delete();
}
}
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button7Click(TObject *Sender)
{
if (ADOTable1->State==dsEdit)
{
ADOTable1->Post();
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button8Click(TObject *Sender)
{
ADOTable1->Cancel();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::DBImage1Click(TObject *Sender)
{
//打开【增加相片字段】的文件选取对话框
if (OpenDialog1->Execute())
{
//进入记录编辑模式
ADOTable1->Edit();
//将指定的图片文件加载对应相片字段的Tfield组件内
ADOTable1DSDesigner4->LoadFromFile(OpenDialog1->FileName);
}        
}
//---------------------------------------------------------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -