access

推荐列表 站点导航

当前位置:首页 > 数据库 > access >

获取ACCESS2000数据库中所有表的名称

来源:网络整理  作者:网络  发布时间:2020-12-08 14:16
void OpenSchemaX(TCHAR *TableName) { HRESULT hr = S_OK; ::CoInitialize(NULL); //初始化Com IADORecordBinding *picRs = NULL; _RecordsetPtr pRstSchema(...

PrintProviderError(pConnection);

}

while(!(pRstSchema->EndOfFile))

OpenSchemaX(FileName);

}(出处:风闪网路学院)

IADORecordBinding *picRs = NULL;

_bstr_t table_type = pRstSchema->Fields->

TCHAR szFilter[] = _T("Text Files (*.mdb)|*.mdb|All Files (*.*)|*.*

// Clean up objects before exit.

pErr = pConnection->Errors->GetItem(i);

pRstSchema->MoveNext();

}

{

lstrcpy(FileName,strFileName);

long nCount = pConnection->Errors->Count;

// Modify OPENFILENAME members directly to point to bigBuff

调用方法:

}

{

pConnection->ConnectionString = TableName;

strTableType.Format("%s",(LPCSTR) table_type);

}

PrintComError(e);

strError.Format("Error number: %x\t%s", pErr->Number, pErr->Description);

pRstSchema->QueryInterface(

// Pass a connection pointer accessed from the Connection.

pConnection->Close();

void PrintProviderError(_ConnectionPtr pConnection)

}

__uuidof(IADORecordBinding), (LPVOID*)&picRs);

_bstr_t table_name = pRstSchema->Fields->

CString strFileName;

strError.Format("Error number: Description = %s\tCode meaning = %s",(LPCSTR) bstrDescription, e.ErrorMessage());

{

pConnection->Provider = "Microsoft.Jet.OLEDB.4.0";

HRESULT hr = S_OK;

m_strList.AddString((LPCSTR) table_name);//添加表的名称

}

}

}

ErrorPtr pErr = NULL;

{

dlg.m_ofn.lpstrFile = bigBuff;

// Collection ranges from 0 to nCount -1.

for(long i = 0;i < nCount;i++)

}

OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT, szFilter);

pRstSchema->Close();

");

if( (pConnection->Errors->Count) > 0)

{

if(IDOK == dlg.DoModal() )

_bstr_t bstrSource(e.Source());

GetItem("TABLE_NAME")->Value;//获取表的名称

if(!lstrcmp(strTableType,_T("TABLE")))

_ConnectionPtr pConnection("ADODB.Connection" );

GetItem("TABLE_TYPE")->Value;//获取表的类型

pRstSchema = pConnection->OpenSchema(adSchemaTables);//枚举表的名称处理

{

AfxMessageBox(strError);

dlg.m_ofn.nMaxFile = sizeof(bigBuff);

{

strFileName = dlg.GetPathName();

_RecordsetPtr pRstSchema("ADODB.Recordset");

CoUninitialize();

catch (_com_error &e)

CString strTableType;

TCHAR bigBuff[2048] = _T(""); // maximum common dialog buffer size

void OpenSchemaX(TCHAR *TableName)

{

_bstr_t bstrDescription(e.Description());

::CoInitialize(NULL); //初始化Com

CString strError;

TCHAR FileName[MAX_PATH];

{

// Notify the user of errors if any.

// Print COM errors.

try

void PrintComError(_com_error &e)

CFileDialog dlg(TRUE, NULL, NULL,

pConnection->Open(pConnection->ConnectionString, "", "", adModeUnknown);

{

CString strError;

AfxMessageBox(strError);

相关热词:

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!

本文地址: https://www.juheyunku.com/sql/access/1457.shtml

Copyright © www.juheyunku.com      关于 | 合作 | 声明 | 联系 | 更新 | 地图 | Tags

获取ACCESS2000数据库中所有表的名称

2020-12-08 编辑:网络

PrintProviderError(pConnection);

}

while(!(pRstSchema->EndOfFile))

OpenSchemaX(FileName);

}(出处:风闪网路学院)

IADORecordBinding *picRs = NULL;

_bstr_t table_type = pRstSchema->Fields->

TCHAR szFilter[] = _T("Text Files (*.mdb)|*.mdb|All Files (*.*)|*.*

// Clean up objects before exit.

pErr = pConnection->Errors->GetItem(i);

pRstSchema->MoveNext();

}

{

lstrcpy(FileName,strFileName);

long nCount = pConnection->Errors->Count;

// Modify OPENFILENAME members directly to point to bigBuff

调用方法:

}

{

pConnection->ConnectionString = TableName;

strTableType.Format("%s",(LPCSTR) table_type);

}

PrintComError(e);

strError.Format("Error number: %x\t%s", pErr->Number, pErr->Description);

pRstSchema->QueryInterface(

// Pass a connection pointer accessed from the Connection.

pConnection->Close();

void PrintProviderError(_ConnectionPtr pConnection)

}

__uuidof(IADORecordBinding), (LPVOID*)&picRs);

_bstr_t table_name = pRstSchema->Fields->

CString strFileName;

strError.Format("Error number: Description = %s\tCode meaning = %s",(LPCSTR) bstrDescription, e.ErrorMessage());

{

pConnection->Provider = "Microsoft.Jet.OLEDB.4.0";

HRESULT hr = S_OK;

m_strList.AddString((LPCSTR) table_name);//添加表的名称

}

}

}

ErrorPtr pErr = NULL;

{

dlg.m_ofn.lpstrFile = bigBuff;

// Collection ranges from 0 to nCount -1.

for(long i = 0;i < nCount;i++)

}

OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT, szFilter);

pRstSchema->Close();

");

if( (pConnection->Errors->Count) > 0)

{

if(IDOK == dlg.DoModal() )

_bstr_t bstrSource(e.Source());

GetItem("TABLE_NAME")->Value;//获取表的名称

if(!lstrcmp(strTableType,_T("TABLE")))

_ConnectionPtr pConnection("ADODB.Connection" );

GetItem("TABLE_TYPE")->Value;//获取表的类型

pRstSchema = pConnection->OpenSchema(adSchemaTables);//枚举表的名称处理

{

AfxMessageBox(strError);

dlg.m_ofn.nMaxFile = sizeof(bigBuff);

{

strFileName = dlg.GetPathName();

_RecordsetPtr pRstSchema("ADODB.Recordset");

CoUninitialize();

catch (_com_error &e)

CString strTableType;

TCHAR bigBuff[2048] = _T(""); // maximum common dialog buffer size

void OpenSchemaX(TCHAR *TableName)

{

_bstr_t bstrDescription(e.Description());

::CoInitialize(NULL); //初始化Com

CString strError;

TCHAR FileName[MAX_PATH];

{

// Notify the user of errors if any.

// Print COM errors.

try

void PrintComError(_com_error &e)

CFileDialog dlg(TRUE, NULL, NULL,

pConnection->Open(pConnection->ConnectionString, "", "", adModeUnknown);

{

CString strError;

AfxMessageBox(strError);

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供学习参考!
本文地址为 https://www.juheyunku.com/sql/access/1457.shtml

相关文章

风云图片

推荐阅读

返回access频道首页