Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO ...

Status
Not open for further replies.

HadiRezaee

Technical User
Mar 9, 2001
165
IR
Hi all,
My source code won't work, what is my wrong ?
My database is Access 2000.


pApp->pConnection->Open(_bstr_t("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Server.mdb;"), _bstr_t(""), _bstr_t(""), adConnectUnspecified);

pApp->pRecordsetACTION->Open(_variant_t(_bstr_t("SELECT * FROM ACTION")), pApp->pConnection.GetInterfacePtr(), adOpenDynamic, adLockOptimistic, adCmdText);

Help me !!!



 
is there some Run method? If so, use it instead of Open when working with queries. Ion Filipski
1c.bmp


filipski@excite.com
 
Take a look at this code:

CoInitialize(NULL);
_ConnectionPtr m_pConn;
m_pConn.CreateInstance(__uuidof(Connection));
m_pConn->Open(_bstr_t("Provider=MSDASQL.1;Persist Security Info=False;Data Source=Probe"),_bstr_t(""),_bstr_t(""),adConnectUnspecified);

_CommandPtr pCommand;
pCommand.CreateInstance (__uuidof (Command));
pCommand->ActiveConnection = m_pConn;
pCommand->CommandText = "Select * From Zone";

_RecordsetPtr pRecordset;
pRecordset.CreateInstance (__uuidof (Recordset));
pRecordset->CursorLocation = adUseClient;
pRecordset->Open ( (IDispatch *) pCommand, vtMissing, adOpenStatic, adLockBatchOptimistic, adCmdUnknown);
 
Thanks 128334, Your sample was useful ...
Other question ...

I'm writing Client & Server program, i'm using ADO ...

If i wanna write program on the Client computer, i must add this line to my source code ?

pRecordset->CursorLocation = adUseClient;

Is that necessery ?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top