Advertisement
ASP_Volume2 String Manipulation #40578

Access MDB

To open MS Access or Ms SQL server database using C/C++ or VC++

AI

AI Summary: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Source Code
original-source
#import "c:\Program Files\Common Files\System\ADO\msado15.dll" \
no_namespace rename("EOF", "EndOfFile")
// This code comes from : www.geocities.com/mokarrabin
#include <stdio.h>
#include <iostream.h>
void main(void)
{
  CoInitialize(NULL);
  try 
  {
  _RecordsetPtr pRst("ADODB.Recordset");
   // Connection String
  _bstr_t strCnn("DRIVER={Microsoft Access Driver (*.mdb)};UID=admin;DBQ=GBOOK.mdb");
	 // Open table
	pRst->Open("SELECT * FROM ProductService where ProductService like '%samir%';", strCnn, adOpenStatic, adLockReadOnly, adCmdText);
	 
	 pRst->MoveFirst();
	 while (!pRst->EndOfFile) {
		 cout<<(char*) ((_bstr_t) pRst->GetFields()->GetItem("ProductService")->GetValue())<<endl;
		 pRst->MoveNext();
	 }
	 pRst->Close();   
	 
  }
  catch (_com_error &e)
  {
   cout<<(char*) e.Description();
  }
::CoUninitialize();
}
Original Comments (3)
Recovered from Wayback Machine