ADO/ATL/Jet 3.5 Provider problem 
Author Message
 ADO/ATL/Jet 3.5 Provider problem

Hi,

Trying to use an ATL-object (Jet 3.5 Provider) to use a stored procedure in
a Jet Database (Created in Access 97). The Stored Procedure has one
parameter. When Im useing the OpenDataSource, the return value is 0, but
when Im trying to
MoveNext or read from the recordset Im getting problem (Expression:
m_spRowset !=0).

Whats the problems? When Im useing the ODBC Provider instead all works
without problems. But, I will try to use the Jet 3.5 Provider to get higher
performence. Please, help me!!!

(code from CPP-file)
 vapenRF.m_whereparmvapenid = 1;
 hr = vapenRF.OpenDataSource();
 if (FAILED(hr))
  return;

 TCHAR Namn[51];
 long            objid;
 CString         strData;
 LVITEM          my_item;
 char            str[254];
 int             ListPos;
 long             item = 0;
 int       i;

 strcpy(Namn, vapenRF.m_colBenamning);

 i = 0;
 while (vapenRF.MoveNext() == S_OK)
 {
.......

Quote:
}

(Code from ATL created header file)

#ifndef __SELECTFROMVAPENWHEREVAPENIDRISKFALL3B_H_
#define __SELECTFROMVAPENWHEREVAPENIDRISKFALL3B_H_

class CSELECTFROMvapenWHEREvapenidRISKFALL3bAccessor
{
public:
 long  m_whereparmvapenid;
 TCHAR  m_colBenamning[256];
 double m_colQ2;
 double m_colQSkog;

BEGIN_PARAM_MAP(CSELECTFROMvapenWHEREvapenidRISKFALL3bAccessor)
 //COLUMN_ENTRY(1, m_whereparmvapenid);
END_PARAM_MAP()

DEFINE_COMMAND(CSELECTFROMvapenWHEREvapenidRISKFALL3bAccessor, _T("{ ? =
CALL SELECT_FROM_vapen_WHERE_vapenid_RISKFALL3 () }"))

 // You may wish to call this function if you are inserting a record and
wish to
 // initialize all the fields, if you are not going to explicitly set all of
them.
 void ClearRecord()
 {
  memset(this, 0, sizeof(*this));
 }

Quote:
};

class CSELECTFROMvapenWHEREvapenidRISKFALL3b : public
CCommand<CAccessor<CSELECTFROMvapenWHEREvapenidRISKFALL3bAccessor> >
{
public:
 HRESULT Open()
 {
  HRESULT  hr;

  hr = OpenDataSource();
  if (FAILED(hr))
   return hr;

  return OpenRowset();
 }
 HRESULT OpenDataSource()
 {
  HRESULT  hr;
  CDataSource db;
  CDBPropSet dbinit(DBPROPSET_DBINIT);

  dbinit.AddProperty(DBPROP_AUTH_CACHE_AUTHINFO, true);
  dbinit.AddProperty(DBPROP_AUTH_ENCRYPT_PASSWORD, false);
  dbinit.AddProperty(DBPROP_AUTH_MASK_PASSWORD, false);
  dbinit.AddProperty(DBPROP_AUTH_PASSWORD, OLESTR(""));
  dbinit.AddProperty(DBPROP_AUTH_PERSIST_ENCRYPTED, false);
  dbinit.AddProperty(DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO, false);
  dbinit.AddProperty(DBPROP_AUTH_USERID, OLESTR("Admin"));
  dbinit.AddProperty(DBPROP_INIT_DATASOURCE,
OLESTR("G:\\Projekt\\SGD\\SourceCode\\SGD.mdb"));
  dbinit.AddProperty(DBPROP_INIT_MODE, (long)3);
  dbinit.AddProperty(DBPROP_INIT_PROMPT, (short)4);
  dbinit.AddProperty(DBPROP_INIT_PROVIDERSTRING,
OLESTR(";COUNTRY=0;CP=1252;LANGID=0x0409"));
  dbinit.AddProperty(DBPROP_INIT_LCID, (long)1033);
  hr = db.Open(_T("Microsoft.Jet.OLEDB.3.51"), &dbinit);
  if (FAILED(hr))
   return hr;

  return m_session.Open(db);
 }
 HRESULT OpenRowset()
 {
  // Set properties for open
  CDBPropSet propset(DBPROPSET_ROWSET);
  propset.AddProperty(DBPROP_IRowsetChange, true);
  propset.AddProperty(DBPROP_UPDATABILITY, DBPROPVAL_UP_CHANGE |
DBPROPVAL_UP_INSERT);

  return CCommand<CAccessor<CSELECTFROMvapenWHEREvapenidRISKFALL3bAccessor>

Quote:
>::Open(m_session, NULL, &propset);

 }
 CSession m_session;

Quote:
};

#endif // __SELECTFROMVAPENWHEREVAPENIDRISKFALL3B_H_


Fri, 24 May 2002 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. ADO/ATL/Jet 4.0 Provider problems with INSERT-sql

2. Problem intalling Microsoft Jet 3.5

3. Annoying Jet 3.5 OLE DB deployment problems

4. How Do I Remove a User with Jet 3.5 and VC++

5. VC 4.2 with Jet 3.5

6. Jet 3.5

7. Rebuilding dbDAO to use Jet 3.5?

8. Rebuilding dbDAO to use Jet 3.5?

9. Jet 3.5 Error

10. Unable to store CLongBinary or CByteArray as OLE Object in Jet 3.5

11. Help - DAO and JET 3.5 and Memory Usage

12. Jet 3.5 Database keeps corrupting

 

 
Powered by phpBB® Forum Software