sriranjani
November 21st, 2003, 08:39 AM
I have to get the user's acces permission for a specified database!
For that I use the command...PERMISSIONS()
I use ADO for establishing a connection to the database..my code is something like this now..
void main(void)
{
ADODB::_ConnectionPtr m_pConnection = NULL;
ADODB::_RecordsetPtr pRecordset = NULL;
VARIANT *vRecordsAffected = NULL;
char ConStr[500];
char str1[50];
BOOL m_bIsConnectionOpen;
// Create an instance of _Connection
HRESULT hr ;
hr = m_pConnection.CreateInstance(__uuidof(ADODB::Connection));
try
{
if (SUCCEEDED(hr))
{
//Open a connectionConStr[0] = '\0';
strcat(ConStr, "Provider=sqloledb;Server=ie10DT2KCO1473;Initial Catalog=Shree;");
strcat(ConStr,"User Id=sa;Password= ;");
m_pConnection->Open(ConStr, "", "", 0);
//If database opened successfully then set IsConnectionOpen to TRUE
if (SUCCEEDED(hr)) m_bIsConnectionOpen = TRUE;
}
/* sprintf(str1,"PERMISSIONS ( OBJECT_ID('TABLE1') )");
pRecordset = m_pConnection->Execute(str1, vRecordsAffected, 1);
}
..
and then the catch function !
Now..
How do i display the return value of the PERMISSIONS function??
kindly help me in this regard!!
For that I use the command...PERMISSIONS()
I use ADO for establishing a connection to the database..my code is something like this now..
void main(void)
{
ADODB::_ConnectionPtr m_pConnection = NULL;
ADODB::_RecordsetPtr pRecordset = NULL;
VARIANT *vRecordsAffected = NULL;
char ConStr[500];
char str1[50];
BOOL m_bIsConnectionOpen;
// Create an instance of _Connection
HRESULT hr ;
hr = m_pConnection.CreateInstance(__uuidof(ADODB::Connection));
try
{
if (SUCCEEDED(hr))
{
//Open a connectionConStr[0] = '\0';
strcat(ConStr, "Provider=sqloledb;Server=ie10DT2KCO1473;Initial Catalog=Shree;");
strcat(ConStr,"User Id=sa;Password= ;");
m_pConnection->Open(ConStr, "", "", 0);
//If database opened successfully then set IsConnectionOpen to TRUE
if (SUCCEEDED(hr)) m_bIsConnectionOpen = TRUE;
}
/* sprintf(str1,"PERMISSIONS ( OBJECT_ID('TABLE1') )");
pRecordset = m_pConnection->Execute(str1, vRecordsAffected, 1);
}
..
and then the catch function !
Now..
How do i display the return value of the PERMISSIONS function??
kindly help me in this regard!!