Click here to Skip to main content
15,905,068 members
Home / Discussions / Database
   

Database

 
GeneralRe: ADO plus sql database Pin
Husein23-Nov-03 0:47
Husein23-Nov-03 0:47 
GeneralRe: ADO plus sql database Pin
ranjjj23-Nov-03 2:36
ranjjj23-Nov-03 2:36 
Generalindex-by table as a return value of PL/SQL procedure Pin
misiek20-Nov-03 23:26
misiek20-Nov-03 23:26 
Generalado Pin
ranjjj20-Nov-03 18:43
ranjjj20-Nov-03 18:43 
GeneralRe: ado Pin
Husein22-Nov-03 3:10
Husein22-Nov-03 3:10 
GeneralRe: ado Pin
ranjjj22-Nov-03 18:54
ranjjj22-Nov-03 18:54 
GeneralRe: ado Pin
Husein22-Nov-03 23:23
Husein22-Nov-03 23:23 
GeneralRe: ado Pin
ranjjj23-Nov-03 0:03
ranjjj23-Nov-03 0:03 
The full code is enclosed herewith!!
When I include the aboce said and run it..the control goes to the catch function..as there's some problem in the above mentioned stt!

void main(void)
{
ADODB::_ConnectionPtr m_pConnection = NULL;
ADODB::_CommandPtr Cmd1;
ADODB::_RecordsetPtr pRecordset = NULL;
VARIANT *vRecordsAffected = NULL;
char ConStr[500];
char str1[50];
_bstr_t bstrProc =( L"sp_StartByteImport" );
BOOL m_bIsConnectionOpen;

// Create an instance of _Connection
HRESULT hr ;
hr = m_pConnection.CreateInstance(__uuidof(ADODB::Connection));
cout << "Connection object created." ;
_variant_t vRecsAffected(0L);

try
{
if (SUCCEEDED(hr))
{
//Open a connection where database is access database : "c:\\emailparsing\\email_details.mdb"
ConStr[0] = '\0';
strcat(ConStr, "Provider=sqloledb;Server=ie10DT2KCO1473;Initial Catalog=Shree;");
strcat(ConStr,"User Id=sa;Password= ;");
/* Provider=Microsoft.Jet.OLEDB.3.51; Data Source="**/
// strcat(ConStr, "C:\\MSSQL7\\Data\\Shree_Data" );

m_pConnection->Open(ConStr, "", "", 0);


//If database opened successfully then set IsConnectionOpen to TRUE

if (SUCCEEDED(hr))
{
m_bIsConnectionOpen = TRUE;
}

}
sprintf(str1,"USE Shree SELECT PERMISSIONS ( OBJECT_ID('TABLE1') )");
pRecordset = m_pConnection->Execute(str1, vRecordsAffected, 1);
_variant_t vtMyVal;
vtMyVal = pRecordset->Fields->Item[long(0)]->Value;
printf("\n%s\n\n",vtMyVal);
ConStr[0] = '\0';
strcat(ConStr, "SELECT * FROM ");
strcat(ConStr,"TABLE1");
pRecordset = m_pConnection->Execute(ConStr, vRecordsAffected, 1);

if (!pRecordset->GetEOFile())
{
int i = 0;
while (!pRecordset->GetEOFile())
{
printf("row %d is '%s %s'\n",i,
(char*) ((_bstr_t) pRecordset->GetFields()->GetItem("id")->GetValue()),
(char*) ((_bstr_t) pRecordset->GetFields()->GetItem("product_name")->GetValue()));
i++;
pRecordset->MoveNext();
}
}
pRecordset->Close();
}
catch (_com_error &e)
{
printf("Description = '%s'\n", (char*) e.Description());
printf("%s\n%s\n%s\n",(char *) e.ErrorMessage(), (char *)e.Source(), (char *)e.Description());
}
::CoUninitialize();
}


ranjani
GeneralRe: ado Pin
ranjjj23-Nov-03 0:03
ranjjj23-Nov-03 0:03 
GeneralRe: ado Pin
Husein23-Nov-03 0:35
Husein23-Nov-03 0:35 
GeneralRe: ado Pin
ranjjj23-Nov-03 0:43
ranjjj23-Nov-03 0:43 
GeneralRe: ado Pin
ranjjj23-Nov-03 2:37
ranjjj23-Nov-03 2:37 
GeneralRe: ado Pin
Husein23-Nov-03 2:54
Husein23-Nov-03 2:54 
GeneralRe: ado Pin
ranjjj23-Nov-03 19:12
ranjjj23-Nov-03 19:12 
GeneralRe: ado Pin
ranjjj24-Nov-03 18:40
ranjjj24-Nov-03 18:40 
GeneralRe: ado Pin
Husein26-Nov-03 21:17
Husein26-Nov-03 21:17 
QuestionInserting identity columns with CommandBuilder generated commands? Pin
Carl Mercier20-Nov-03 7:51
Carl Mercier20-Nov-03 7:51 
AnswerRe: Inserting identity columns with CommandBuilder generated commands? Pin
Husein22-Nov-03 3:33
Husein22-Nov-03 3:33 
GeneralChange row header in data grid Pin
SathishVJ20-Nov-03 6:39
SathishVJ20-Nov-03 6:39 
Generalsql dmo quest Pin
ranjjj19-Nov-03 18:28
ranjjj19-Nov-03 18:28 
GeneralRe: sql dmo quest Pin
Johnny Go-Lightly20-Nov-03 14:34
sussJohnny Go-Lightly20-Nov-03 14:34 
QuestionHow does DataView.RowFilter works? Pin
Alexandru Savescu19-Nov-03 7:11
Alexandru Savescu19-Nov-03 7:11 
AnswerRe: How does DataView.RowFilter works? Pin
Husein23-Nov-03 2:51
Husein23-Nov-03 2:51 
GeneralSelect reads from XML file in ado.net Pin
imran_shahid@msn.com18-Nov-03 21:24
imran_shahid@msn.com18-Nov-03 21:24 
Questionhow to apply filter to Master/Detail records in dataset Pin
imran_shahid@msn.com18-Nov-03 21:19
imran_shahid@msn.com18-Nov-03 21:19 

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.