ACCESS复制A数据库xx表到B数据库XX表?

grace_zou 2011-09-30 03:25:43
用DELPHI怎么写代码,实现ACCESS复制A数据库xx表到B数据库XX表?

A数据库在优盘,B数据库在DELPHI所编写的EXE路径,通过单击确定按钮后,实数据库xx表复制到B数据库XX表?

在网上看到有人这样写:select * into XX in [A数据库路径] from XX,可是试了一下不行
请帮写全代码?
...全文
794 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
有心人问道 2013-04-01
  • 打赏
  • 举报
回复
朋友,请问你这个问题最终是怎么解决的?可以说说具体的方法吗?
項子 2011-10-28
  • 打赏
  • 举报
回复
你直接insert到B表中去阿!
fsk_wyf 2011-10-27
  • 打赏
  • 举报
回复
64保存数据到配置文件UINT32 SaveCmdDataToFile(PPNP_Report_MSG pstMsg){26 = 570;
UINT8 ucAddr= 570;UINT32 ulRet = CCU_ERR;PMANAGE485_CmdT pstCmd = 572; PCCU_CHAN_T pstChan = 572;
PRS485_BOARD_T pstNode = 572;CHECK; if (CCU_TRUE == IsCCUWorkInWireless(CCU_RESID)){221;}573;581; (VOID)575;
if ( 572 == pstNode ){ return CCU_485_ERR_NODE_INIT;}ulRet = GetCmdInfo(pstNode, (UINT8)pstMsg->uwCmd, &pstCmd);
if ( (CCU_OK != ulRet)|| (572 == pstCmd)){return CCU_485_ERR_CONFIG_CMD; }
/* 如果是查询类接口,不需调配置模块接口保持配置文件,直接返回 */
if ( 1 == pstCmd->ucDirType){221;}if ( pstMsg->uwSeq > TO_PNP_TAB_SIZE ){ return CCU_485_ERR_LENGTH_OVERLOAD;}
/* 如果命令执行成功,保存数据 */if ( CCU_OK == 577[576] ){
SaveCFGCmdData(pstMsg->ulResId, pstNode->enShelfType, (UINT8)pstMsg->uwCmd, pstNode->cBarCode, 5771, pstMsg->ulTempLen);
SaveCfgFileCmd(pstMsg->ulResId, (UINT8)pstMsg->uwCmd); }221;}
return CCU_OK 01 return CCU_ERR 02 CCU_NULL_PTR 03 CHECK_RET_OK(ulRet)04 CCU_NULL_BYTE 06
CCU_NULL_LONG 07 ulRet = IsResIdRight(pstMsg->ulResId, &ucChanNum, &ucAddr) 08
ulRet = GetChanNode(pstMsg->ulResId, &pstChan, &pstNode) 09 CCU_MemFree(CCU_MEM_INFO 11
g_ast485BoardInfo[ucChanNum][ucAddr] 14 pstMsg->aucCmdData 15 CCU_NODE_STATE_SYNC 17
CCU_NODE_STATE_NOREG 18 g_stCCUChan[ucChanNum].pstNodeList[ucAddr] = pstNode 21
MAX_REG_VER_LEN 22 pstMsg->ulLen 23 PRS485_BOARD_T pstNode 24 PCCU_CHAN_T pstChan 25
UINT8 ucChanNum 26 UINT8 ucAddr 27 UINT32 ulRet = CCU_ERR 31 CHECK_RET_OK_RN(ulRet, ulRet) 33
return CCU_ERR_MPI_INVALID_PARAMS 34 pstNode->enBoardType 35 pstNode->enHswState 36 if (CCU_OK != ulRet) 38
处理通道中的PNP上报回写消息 VOID ProcPnPMsg(PMANAGE_MSG_FRAME pstMsg)
PNP上报注册请求处理VOID ProcPnPReportRegInfo(PPNP_Report_EVT pstMsg)
PNP上报去注册事件处理VOID ProcPnPReportUnRegEvt(PPNP_Report_EVT pstMsg)
处理通信恢复事件UINT32 ProcCommResumeEvt(PPNP_Report_EVT pstMsg)
处理PNP上报的事件VOID ProcPnPEvt(PMANAGE_MSG_FRAME pstMsg)
{ PNP_RESP_MSG_TYPE enMsgType = PNP_RESP_INVALID_TYPE;PPNP_Report_MSG pstTempMsg = 03;CHECK;
pstTempMsg = (PPNP_Report_MSG)pstMsg->ucData;enMsgType = pstTempMsg->enType;
/* 将设置类数据保存到配置文件,必需在消息处理释放控制表之前保存 */SaveCmdDataToFile(pstTempMsg);
switch ( enMsgType ){case PNP_RESP_ASY_TYPE: /* 异步消息 */ProcRespAsyMsg(pstTempMsg);break;
case PNP_RESP_SYNC_TYPE:/* 同步消息 */ProcRespSynMsg(..);..;
case PNP_RESP_ALARM_TYPE: /* 告警消息 */ ProcRespAlarmMsg(..);..;default:break;}return;}
fsk_wyf 2011-10-27
  • 打赏
  • 举报
回复
{26 = 06;27= 06;44= 07;25 = 03;24 = 03;
CHECK(pstMsg);08;04;09;04;/* 如果不为空,删除后重新创建 */if ( 03 != pstNode ){ulRet = DeleteNode(pstMsg->ulResId);
04;}/* 这里还没有获取到部件电子标签,不能调配置管理模块获取命令参数,只建立初始节点并初始化 */
pstNode =(RS485_BOARD_T*)CCU_MemAlloc(CCU_MEM_INFO, CCU_MEM_PT_NO,sizeof(RS485_BOARD_T));CHECK_PARA1_NULL(pstNode);
pstNode->ulResId = pstMsg->ulResId;..->ucChanNum = ucChanNum;..->ucNodeNum= ucAddr;..->ucIsInitOK = CCU_FALSE;
..->ucCurInitPos= 0;..->ucCurPollPos= 0;..->ulTcuFlag = CCU_FALSE;..->ulFmuFlag = CCU_FALSE;..->ucCmdCnt = 0;
..->ucInitCmdNum= 0;..->ucPollCmdNum= 0;..->pstCmdList= 03; ..->enBoardState=CCU_NODE_STATE_RUNNING;..->enHswState=18;
..->ulIsCreatNodeOK = CCU_FALSE;if ( 23 > 22){11, pstNode); pstNode = 03; return;}/* 存储注册请求消息 */
pstNode->ulRegLen = 23;CCU_MemCpy(pstNode->ucRegInfo, 15, (INT32)23);21;CCU_MemSet(14.ucRegInfo, 0, 22);
CCU_MemCpy(14.ucRegInfo, 15, (INT32)23);14.ulRegLen= 23;14.ulResId = pstMsg->ulResId;14.ucIsInitOK = CCU_FALSE;
14.enHswState = 18;14.ucCurPollPos = 0;14.ucCmdCnt = 0;14.ucInitCmdNum = 0; return; }
{CHECK;/* 删除部件管理模块节点 */(VOID)DeleteNode(pstMsg->ulResId); /* 删除告警模块管理节点 */
(VOID)ALM_DeleteAlarmNode(..);(VOID)ALM_DeleteNodeRelationAlarm(..d);.._DeleteNodeShieldAlarm(..);
.._DeleteNodeAlarmInfo(..);return;}
{26 = 06;27 = 06;44 = 07;25 = 03;
24 = 03;CHECK;08;33;09;33;CHECK;/* 只有GATM会报通信恢复 */if ( CCU_485_GATM_TYPE_B1 != 35){ 34;}14.ulRegLen = 0;
14.ucIsInitOK = CCU_TRUE;14.enHswState = 17;14.ucCurPollPos = 0;14.ucCmdCnt = 0;14.ucInitCmdNum = 0;36 = 17;01;}
{31;PPNP_Report_EVT pstTempMsg = 03;CHECK;pstTempMsg = (PPNP_Report_EVT)pstMsg->ucData;
switch ( pstTempMsg->enEvtType){case CCU_BOARD_REG_REQ : ProcPnPReportRegInfo(pstTempMsg);
break;case CCU_BOARD_VER_INFO :ProcPnPReportVerInfo(..);ulRet = GetRs485BoardRecordInfo(..);38{
MANAGER_DBG_ERROR("get 485BoardRecordInfo failed, ulRet is:0x%x \r\n", (UINT)ulRet);}..;case CCU_BOARD_UNREGISTER :
ProcPnPReportUnRegEvt(..);ulRet = UnRegRs485BoardRecordInfo(..);38{MANAGER_DBG_ERROR..;}..;
case CCU_BOARD_COMM_RESUME :ProcCommResumeEvt(..);..;default:MANAGER_DBG_ERROR..;..;}return;}
加载模块消息处理VOID ProcDownLoadMsg(PMANAGE_MSG_FRAME pstMsg)
部件管理模块定时消息处理VOID ProcTimer1HMsg()
{PDOWN_485_FRAME pstTempMsg = 03;CHECK;pstTempMsg = (PDOWN_485_FRAME)pstMsg->ucData;
switch ( pstTempMsg->ucNetFn ){case CCU_485LOAD_TYPE:Proc485InterCmd(pstTempMsg); break; default:..;}return;}
{/* 以一小时为粒度记录传感器的读值 */(VOID)SendSensorMsg2Log();
/* 以一小时为粒度记录柜内温湿度传感器的值 */(VOID)CCU_RegisterTemHumValue();}
grace_zou 2011-10-26
  • 打赏
  • 举报
回复
ADOConnection1.Connected := False;
ADOConnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+ExtractFilePath(ParamStr(0))+'A.mdb;User ID=admin;Password=;Jet OLEDB:Database Password=1';
ADOConnection1.LoginPrompt:= false;
ADOConnection1.Connected:= true;
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add( 'delete * from cr');
adoquery1.ExecSQL;
t:=' insert into cr select * from cr in '+QuotedStr('F:\B.mdb');
ADOConnection1.Execute(t,cmdText,[eoExecuteNoRecords]);
这样可以实现复制没有加密码的数据表,但是加了数据库加了密码后,就报错“密码无效”,请高手指点!
grace_zou 2011-10-20
  • 打赏
  • 举报
回复
ADOConnection1.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+ExtractFilePath(ParamStr(0))+A.mdb;User ID=admin;Password=;Jet OLEDB:Database Password=1';
ADOQuery1.SQL.Text:='select * into car in 'F:\bakupdate\B.mdb' from car';
我这样写编译时'F:\bakupdate\B.mdb' 报错:
[错误] Unit1.pas(81): Missing operator or semicolon
[错误] Unit1.pas(81): Illegal character in input file: '\' ($5C)
[错误] Unit1.pas(81): Statement expected, but expression of type 'String' found
请问要怎么写才对?请详细一点,谢谢
山东蓝鸟贵薪 2011-10-19
  • 打赏
  • 举报
回复
可以将这个SQL语句在MSSQL数据库运行一下看看
是不是代码有问题呀
grace_zou 2011-10-19
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 bdmh 的回复:]
比如adoquery1连接的是A数据库,那么

select * into tableB in 'c:\B.mdb' from tableA
[/Quote]
这样写编译时"c:"报错
bdmh 2011-09-30
  • 打赏
  • 举报
回复
比如adoquery1连接的是A数据库,那么

select * into tableB in 'c:\B.mdb' from tableA

2,496

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧