Q | access数据库SQL问题 |
T | 有两个access的MDB文件(f1.mdb f2.mdb),每个文件里都有一个表为ta,ta有两个字段为"名称","数量",现在要合并这两个MDB文件的数据到第三个文件(f3.mdb该文件已经有一个空的表ta),第三个文件数据结构和这两个MDB文件一致。合并时如果名称相同则数量相加,我不想一条记录一条记录的处理。我在网上看到在access不同数据库中的表进行链接(in)介绍,我想用链接(in)类似下面代码解决问题 insert into ta(名称,数量) select * from 文件f1的ta,in 文件f2的ta group by 名称 请问这个SQL怎么写? |
A | select [name],sum([count]) as sumofcount from query1 group by name |
Q | 想用access做个学生成绩统计的数据库,请问如何实现自动生成名次? |
T | 谢了 |
A | 用一个查询就可以 比如按成绩顺序的话,你统计一下成绩比当前成绩多的学生数目就可以了 一点都不难 select rank=count(*), a1.studentname, a1.score from student a1, student a2 where a1.score >= a2.score group by a1.studentname, a1.score order by a1.score SELECT a1.studentid, a1.studentname, a1.score, Sum(a2.studentid) AS rank FROM student AS a1, student AS a2 WHERE (((a1.score)>=[a2].[score])) GROUP BY a1.studentid, a1.studentname, a1.score ORDER BY a1.studentname, a1.score; |
Q | 高手请指教!! |
T | 以下是我有DAO技术访问ACCESS中的二进制信息: m_pRecordset->Move(81304); COleVariant BinaryValue; m_pRecordset->GetFieldValue("Index",BinaryValue);//"Index"是OLE型的 UINT MyInt1[10]; memcpy(MyInt1,BinaryValue.puintVal,40); / 为什么取不出二进制信息呢? |
A | value的类型应该是VT_ARRAY吧……不能当int*使用的…… Visual C++ Concepts: Adding Functionality DAO Record Field Exchange (DFX) DFX_BinarySee Also MFC Macros and Globals | DFX_Text | DFX_Bool | DFX_Currency | DFX_Long | DFX_Short | DFX_Single | DFX_Double | DFX_DateTime | DFX_Byte | DFX_LongBinary | CDaoFieldExchange::SetFieldType Transfers arrays of bytes between the field data members of a CDaoRecordset object and the columns of a record on the data source. void AFXAPI DFX_Binary( CDaoFieldExchange* pFX, LPCTSTR szName, CByteArray& value, int nPreAllocSize = AFX_DAO_BINARY_DEFAULT_SIZE, DWORD dwBindOptions = 0 ); |
Q | 请问:WIN98下怎样注册MSADO15.DLL这个组件? 用regsvr32.exe msado15.dll它说loadlibrary fail |
T | MSADO15.DLL是从WIN XP HOME版拷过来的。我的程序在XP下运行正常,能使用access数据库。 把程序拷到WIN 98下,运行时非法操作,指向ADO的执行语句。在WIN98的系统目录下想注册MSADO15.DLL。命令行如下: c:/pwin98/system/regsvr32.exe msado15.dll 报错:LoadLibrary("msado15.dll") fail! 我应该怎样注册这个ADO COM组件?? 谢谢! |
A | MSDN MDAC SDK Technical Articles Redistributing Microsoft Data Access Components ADO 2.7 Programmer's Guide Installing and Redistributing ADO MDAC components consist of a matched set of dynamic-link libraries (DLLs). It is not enough to simply install Msado15.dll, for example, for ADO to work correctly. You need the complete set of ADO DLLs, as well as an underlying OLE DB provider (which usually has one DLL plus a set of helper DLLs) and ODBC. You can download the latest version of MDAC_TYP.exe from the following Microsoft Web site: http://www.microsoft.com/data/download.htm The MDAC_TYP.exe setup includes only the binaries necessary to redistribute the components; it doesn't include documentation. Note that in addition to MDAC_TYP.exe, you may need to distribute DCOM95 for your Windows 95 clients. DCOM must be installed prior to the installation of MDAC. Note that Windows 2000, Windows NT 4.0, and Windows 98 have DCOM built in. You can download the latest version of DCOM95 from the following Microsoft Web site: http://www.microsoft.com/com Note that DCOM must be installed separately and before MDAC_TYP.exe and your Setup program. DCOM cannot be installed from within your Setup program. |
Q | 吐血!如何从数据库中得到1970年以前的时间? |
T | 用CRecordset类得到数据库中的时间的时候,发现对于1970年以前的时间,无论如何返回的都是1970-1-1,查MSDN才知道CRecordset交换时间用的是RFX_DATE,而这个返回的时间类型是CTime类型的,CTime类型的时间又限制在1970-2038,当时就快吐血了,各位老兄帮忙,分不够可以再加,只要解决这个问题啊。 |
A | void AFXAPI DFX_DateTime( CDaoFieldExchange* pFX, LPCTSTR szName, COleDateTime& value, DWORD dwBindOptions = AFX_DAO_ENABLE_FIELD_CACHE ); |
Q | 如何创建ACCESS2000数据库.mdb文件 |
T | 用ADO能否实现? |
A | 可以。也可以用SQLConfigDataSource创建。 Use of SQLConfigDataSource ODBC installer DLL API function: BOOL fCreated; fCreated = SQLConfigDataSource(NULL, ODBC_ADD_DSN, "Microsoft Access Driver (*.mdb)", "CREATE_DB=.//ATest.mdb General/0" ); This will create ATest.mdb in the application's working directory using general sorting. BOOL SQLConfigDataSource(hwndParent, fRequest, lpszDriver, lpszAttributes) Where: hwndParent is either NULL if no dialogs are to be displayed or a valid hwnd to act as parent to any driver generated dialogs. fRequest is ODBC_ADD_DSN to specify creation of the .mdb file. lpszDriver is Microsoft Access Driver (*.mdb). lpszAttributes is "CREATE_DB=<path><filename>.mdb <sort order>/0" where the <path><filename> combination identifies where the file should be created and <sort order> is language sorting order (for example, General). <path> must be specified even if the .mdb is to be created in the current working directory. Use standard relative path syntax. NOTE: Unlike most other ODBC API functions, SQLConfigDataSource returns a boolean value. This return value is TRUE if the .mdb was created, FALSE if creation failed. |
Q | 如何用ADO中的_RecordsetPtr对象做参数(变量)查询? |
T | 比如说: _RecordsetPtr m_pRecordset; m_pRecordset->("select * from 表名 where 字段名=一个变量",...)这句话改如何写?谢谢 |
A | #import "C:/Program Files/Common Files/System/ado/msado15.dll" / rename( "EOF", "adoEOF" ) ... _variant_t vtEmpty (DISP_E_PARAMNOTFOUND, VT_ERROR); _variant_t vtEmpty2(DISP_E_PARAMNOTFOUND, VT_ERROR); ... ADODB::_ConnectionPtr Conn1; ADODB::_CommandPtr Cmd1; ADODB::_ParameterPtr Param1; ADODB::_RecordsetPtr Rs1; // Trap any error/exception. try { // Create and Open Connection Object. Conn1.CreateInstance( __uuidof( ADODB::Connection ) ); Conn1->ConnectionString = _bstr_t(L"DSN=Biblio;UID=adimin;PWD=;"); Conn1->Open( _bstr_t(L""), _bstr_t(L""), _bstr_t(L""), -1 ); // Create Command Object. Cmd1.CreateInstance( __uuidof( ADODB::Command ) ); Cmd1->ActiveConnection = Conn1; Cmd1->CommandText = _bstr_t(L"SELECT * FROM Authors " L"WHERE Au_ID < ?"); // Create Parameter Object. Param1 = Cmd1->CreateParameter( _bstr_t(L""), ADODB::adInteger, ADODB::adParamInput, |
数据库:DAO和ADO,Access和MSSQL等
最新推荐文章于 2024-03-26 02:32:04 发布