Click here to Skip to main content
15,888,454 members
Home / Discussions / Database
   

Database

 
AnswerRe: Blob in 60 seconds [modified] Pin
BeerFizz31-May-06 1:54
BeerFizz31-May-06 1:54 
AnswerRe: Blob in 60 seconds [modified] Pin
Eric Dahlvang31-May-06 3:19
Eric Dahlvang31-May-06 3:19 
GeneralRe: Blob in 60 seconds [modified] Pin
BeerFizz31-May-06 3:46
BeerFizz31-May-06 3:46 
GeneralRe: Blob in 60 seconds [modified] Pin
Eric Dahlvang31-May-06 5:08
Eric Dahlvang31-May-06 5:08 
GeneralRe: Blob in 60 seconds [modified] Pin
BeerFizz31-May-06 5:30
BeerFizz31-May-06 5:30 
GeneralRe: Blob in 60 seconds [modified] Pin
Eric Dahlvang31-May-06 6:19
Eric Dahlvang31-May-06 6:19 
GeneralRe: Blob in 60 seconds [modified] Pin
BeerFizz31-May-06 6:17
BeerFizz31-May-06 6:17 
QuestionPls Help - Visual C++ with ADO Pin
antonaras30-May-06 5:52
antonaras30-May-06 5:52 
Hi again
I'm trying to connect to an access db using ADO
i use some sample codes to perform a simple SELECT query and display them through a recordset. I've tryed really hard to make it work i've searched everywhere pls help me find the problem.
This is the code i use::
<br />
<br />
<br />
#include <br />
#include <br />
#include <br />
<br />
#import "C:\Program Files\Common Files\System\ADO\msado15.dll" \<br />
no_namespace rename("EOF", "EndOfFile")<br />
<br />
void main(int argc, char* argv[])<br />
{<br />
<br />
HRESULT hr = S_OK;<br />
_ConnectionPtr m_pConn;<br />
try<br />
{<br />
HRESULT hr = m_pConn.CreateInstance(__uuidof(Connection));<br />
if (FAILED( hr ))<br />
cout<<"Can't create an intance of ADO.Connection"<<endl;<br />
<br />
if (FAILED( m_pConn->Open(_bstr_t("Provider=Microsoft.Jet.OLEDB.4.0;Data Source =ADOTestDB.MDB"),<br />
_bstr_t( "" ),<br />
_bstr_t( "" ), <br />
adModeUnknown )))<br />
<br />
cout<<"Can't open datasource"<<endl;<br />
<br />
<br />
_CommandPtr pCommand;<br />
pCommand.CreateInstance (__uuidof (Command));<br />
pCommand->ActiveConnection = m_pConn; <br />
pCommand->CommandText = "Select Name,Dept From Student";<br />
_RecordsetPtr pRecordset;<br />
pRecordset.CreateInstance (__uuidof (Recordset));<br />
pRecordset->CursorLocation = adUseClient;<br />
pRecordset->Open ( (IDispatch *) pCommand, vtMissing, adOpenStatic,<br />
adLockBatchOptimistic, adCmdUnknown);<br />
<br />
_bstr_t valField1;<br />
int valField2;<br />
pRecordset->MoveFirst();<br />
if (!pRecordset->EndOfFile)<br />
{<br />
while(!pRecordset->EndOfFile)<br />
{<br />
valField1 = pRecordset->Fields->GetItem("Name")->Value;<br />
valField2 = pRecordset->Fields->GetItem("Dept")->Value.intVal;<br />
printf("%d - %s\n",valField2,(LPCSTR)valField1);<br />
pRecordset->MoveNext();<br />
}<br />
}<br />
<br />
<br />
}catch( _com_error &ce )<br />
{<br />
printf("Error:%s\n",ce.Description);<br />
<br />
}<br />
m_pConn->Close();<br />
<br />
}<br />



i get an exeption
"Can't create an intance of ADO.Connection"
and the i asks if i want to debug
Pls help me i'm trying a lot to connect to a db and enything i do seems to be wrong
and the truth is that everytime i post a msg about C++ and ADO no one
replies.
pls i'm desparate
AnswerRe: Pls Help - Visual C++ with ADO [modified] Pin
George L. Jackson30-May-06 11:29
George L. Jackson30-May-06 11:29 
QuestionADO Books Pin
Rajkamal_dfine30-May-06 4:23
Rajkamal_dfine30-May-06 4:23 
QuestionConnection error Pin
Paps230-May-06 3:22
Paps230-May-06 3:22 
AnswerRe: Connection error Pin
Jerry Hammond30-May-06 7:18
Jerry Hammond30-May-06 7:18 
QuestionTrap difference between two records... Pin
deep730-May-06 2:31
deep730-May-06 2:31 
AnswerRe: Trap difference between two records... Pin
Colin Angus Mackay30-May-06 2:47
Colin Angus Mackay30-May-06 2:47 
GeneralRe: Trap difference between two records... Pin
deep730-May-06 18:15
deep730-May-06 18:15 
GeneralRe: Trap difference between two records... Pin
r.stropek4-Jun-06 6:35
r.stropek4-Jun-06 6:35 
QuestionHow to convert the Sql tables to stored procedure Pin
a_n_sowmya30-May-06 0:31
a_n_sowmya30-May-06 0:31 
AnswerRe: How to convert the Sql tables to stored procedure Pin
Colin Angus Mackay30-May-06 2:12
Colin Angus Mackay30-May-06 2:12 
AnswerRe: How to convert the Sql tables to stored procedure Pin
sathish s31-May-06 2:06
sathish s31-May-06 2:06 
GeneralRe: How to convert the Sql tables to stored procedure Pin
a_n_sowmya31-May-06 5:46
a_n_sowmya31-May-06 5:46 
GeneralRe: How to convert the Sql tables to stored procedure Pin
sathish s31-May-06 19:02
sathish s31-May-06 19:02 
GeneralRe: How to convert the Sql tables to stored procedure Pin
a_n_sowmya31-May-06 19:31
a_n_sowmya31-May-06 19:31 
Questionhow to apply where condition on date field in msaccess Pin
GANsJob29-May-06 22:02
GANsJob29-May-06 22:02 
AnswerRe: how to apply where condition on date field in msaccess Pin
Michael Potter30-May-06 8:46
Michael Potter30-May-06 8:46 
GeneralRe: how to apply where condition on date field in msaccess Pin
GANsJob1-Jun-06 3:55
GANsJob1-Jun-06 3:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.