Hi Francisco,
> 1- How i can hide the login window when try to connect a SAPDB Database and
> use login by code? (Windows NT 4.0 and ODBC)
Hope I got this right: You want to know how best to connect to your SAP DB
programmatically?
What programming technology are you using? DAO, ADO, BDE?
I strongly suggest ADO, because we have the best experiences with this so far.
Set up an DSN to your DB in the ODBC Manager, create an empty (0 Bytes!) file
"test.udl" and doubleclick on it.
In the Data Link Properties Dialog set up your connection and enable saving the
password. Test and ok.
Open test.udl in a text editor, copy the Provider string to your Application Ini-
File and use it as the connection string. It will be something like that:
"Provider=MSDASQL.1;Password=dba;Persist Security Info=True;User ID=dba;Data
Source=TESTDB"
In commercial applications I suggest encrypting the provider string ;)
You can also call the Data Link Properties Dialog from within your application
easily, and then use the resulting provider string:
CString SetupADOConnection( HWND hwndMain){
CString result;
CDataSource data;
if( NULL == hwndMain) return result;
CComPtr<IDataInitialize> pIDataInitialize;
pIDataInitialize.CoCreateInstance( CLSID_DataLinks, NULL, CLSCTX_INPROC_SERVER);
CComQIPtr<IDBPromptInitialize> pIDBPromptInitialize(pIDataInitialize);
CComPtr<IDBProperties> pIDBProperties;
HRESULT hr = pIDBPromptInitialize->PromptDataSource(
NULL, hwndMain, DBPROMPTOPTIONS_PROPERTYSHEET, 0, NULL,
NULL, IID_IDBProperties, reinterpret_cast<IUnknown **>(&pIDBProperties));
LPOLESTR szInitString = NULL;
pIDataInitialize->GetInitializationString(pIDBProperties, true, &szInitString);
CComBSTR initstr(szInitString);
result = BSTR(initstr);
if(szInitString) CoTaskMemFree((void*)szInitString);
return result;
}
Sincerely, Axel
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general