허접 답변 사양 소스만 컴파일해도 알수있게 답해줘요.
자신 없음 다음 문장에 대해서만이라도 설명해주세요
--> CreateObject("ADODB.Recordset");
질문 드리고 싶은건 첨부되 파일 소스를 수정해서 인위적으로 create table [tablename]어쩌구 저쩌구도 코드 상에서
실해이 되서 동적으로 테이블을 만들고 싶다는 겁니다.
http://codecentral.borland.com/codecentral/ccweb.exe/listing?id=19860
여기에 있는 소스(검색에서 ado access) 받아서 공부 하고 있는데요
table 생성을 어떻게 해야하는지 잘 모르겠습니다.
다음은 mdb 여는 부분이고요...
OpenDialog1->Title="Open MS Access database";
Create=false;
if(OpenDialog1->Execute())
{
if(!FileExists(Form1->OpenDialog1->FileName))
{
ShowMessage("File is not exist");
return;
}
Form1->Catalog.Exec(PropertySet("ActiveConnection") <<
("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Form1->OpenDialog1->FileName));
Form1->Label2->Caption=Form1->OpenDialog1->FileName;
ListBox1->Clear();
Form1->CatTables=Form1->Catalog.Exec(Function("Tables"));
//numbers of tables
int NumTables=Form1->CatTables.Exec(PropertyGet("Count"));
Form4->ListBox1->Clear();
for(int i=0; i<NumTables; ++i)
{
Variant item=Form1->CatTables.Exec(PropertyGet("Item") << i);
Form1->ListBox1->Items->AddObject(item.Exec(PropertyGet("Name")),(TObject*)(IDispatch*)item);
}
}
다음은 mdb 만드는 부분입니다.
OpenDialog1->Title="Create MS Access database";
Create=true;
if(OpenDialog1->Execute())
{
if(FileExists(Form1->OpenDialog1->FileName))
{
ShowMessage("File exist and will be recreated");
DeleteFile(Form1->OpenDialog1->FileName);
}
Form1->ListBox1->Clear();
Form1->Catalog.Exec(Function("Create") <<
("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Form1->OpenDialog1->FileName));
Form1->Label2->Caption=Form1->OpenDialog1->FileName;
}
try
{
RecordSetDB=Variant::CreateObject("ADODB.Recordset");
}
catch(EOleSysError &err)
{
Application->MessageBox("Could not create Recordset object",err.Message.c_str(),MB_OK);
Application->Terminate();
return;
}
..
..
..
..
도대체 .Exec(PropertySet ... 이런건 어딜 참고로 만들어 지는지 알수가 없네요