Click here to Skip to main content
15,891,529 members
Home / Discussions / COM
   

COM

 
AnswerRe: How to add a popup menu into Explorer Bar ActiveX Control? Pin
Amit Dey27-Apr-02 19:21
Amit Dey27-Apr-02 19:21 
GeneralATL-based subclassed windowed control flickers on resize Pin
Mr Matt Ellis, Esq23-Apr-02 5:39
Mr Matt Ellis, Esq23-Apr-02 5:39 
QuestionHow to use COM Objects in VC++ - Please Help Pin
23-Apr-02 1:33
suss23-Apr-02 1:33 
AnswerRe: How to use COM Objects in VC++ - Please Help Pin
Paul M Watt24-Apr-02 8:27
mentorPaul M Watt24-Apr-02 8:27 
QuestionHow to use COM Objects in VC++ Pin
23-Apr-02 1:32
suss23-Apr-02 1:32 
AnswerRe: How to use COM Objects in VC++ Pin
ThatsAlok19-Jul-09 0:18
ThatsAlok19-Jul-09 0:18 
QuestionHow to generate a real certificate Pin
liuage22-Apr-02 17:27
liuage22-Apr-02 17:27 
QuestionHow to solve this problem??? Pin
chq1222-Apr-02 6:37
chq1222-Apr-02 6:37 
I wrote a method in COM, has two parameters, BSTR bstrUserID and BSTR bstrUserPwd. I set type in SQL Server as varchar, I used stored procedure to execute a search in database.

Method:

STDMETHODIMP CStudentManager::LogOn(BSTR bstrUserID, BSTR bstrUserPwd)
{
// TODO: Add your implementation code here

BSTR UserID = ::SysAllocString(L"UserID");
BSTR UserPwd = ::SysAllocString(L"Passward");

VARIANT vUser, vPassword;
vUser.vt = VT_BSTR;
vUser.bstrVal = bstrUserID;
vPassword.vt = VT_BSTR;
vPassword.bstrVal = bstrUserPwd;
m_Comm->CommandText = L"LogOn";
HRESULT hr = AppendParameter(UserID, adChar, vUser, adParamInput,20);
if(SUCCEEDED(hr))
hr = AppendParameter(UserPwd, adChar, vPassword, adParamInput,20);
if(SUCCEEDED(hr))
m_Comm->Execute(pvtEmpty1, pvtEmpty2, adCmdText);

if(hr == 0)hr = S_OK;
else hr = E_FAIL;

m_Comm->Parameters->Release();
m_pRs->Close();
::SysFreeString(UserID);
::SysFreeString(UserPwd);

return hr;
}

Stored Procedure:
Create Procedure LogOn
(
@ID,
@Password
)
as
if EXISTS(Select userid from users where userid = @ID and userpwd = @Password
return 0
else
return 1

Go

I used a client function to logon: hr = pManager->LogOn(LogonID, LogonPwd);
I found the function can work, but always return E_FAIL even when database has userid and password.
I thought there is some wrong in define the type, but I can not find it out.

So could anyone tell me when I used BSTR in COM and varchar in SQL SERVER, what should i pay attention to ?
AnswerRe: How to solve this problem??? Pin
Vi223-Apr-02 6:11
Vi223-Apr-02 6:11 
GeneralRe: How to solve this problem??? Pin
chq1223-Apr-02 12:58
chq1223-Apr-02 12:58 
GeneralRe: How to solve this problem??? Pin
Vi223-Apr-02 21:05
Vi223-Apr-02 21:05 
GeneralIPictureDisp with copy constructor Pin
21-Apr-02 1:27
suss21-Apr-02 1:27 
GeneralRe: IPictureDisp with copy constructor Pin
Vi223-Apr-02 21:25
Vi223-Apr-02 21:25 
GeneralRe: IPictureDisp with copy constructor Pin
26-Apr-02 0:25
suss26-Apr-02 0:25 
GeneralRe: IPictureDisp with copy constructor Pin
Vi226-Apr-02 23:45
Vi226-Apr-02 23:45 
GeneralRe: IPictureDisp with copy constructor Pin
27-Apr-02 1:59
suss27-Apr-02 1:59 
GeneralRe: IPictureDisp with copy constructor Pin
Vi227-Apr-02 4:11
Vi227-Apr-02 4:11 
GeneralRe: IPictureDisp with copy constructor Pin
27-Apr-02 5:48
suss27-Apr-02 5:48 
QuestionHow to use an activex when user does not have an administrator account ? Pin
Jean-Michel LE FOL19-Apr-02 23:17
Jean-Michel LE FOL19-Apr-02 23:17 
GeneralLinker Error Pin
Madmaximus19-Apr-02 4:20
Madmaximus19-Apr-02 4:20 
GeneralRe: Linker Error Pin
Tim Smith19-Apr-02 4:25
Tim Smith19-Apr-02 4:25 
GeneralCComPtr Pin
19-Apr-02 2:57
suss19-Apr-02 2:57 
GeneralRe: CComPtr Pin
Tim Smith19-Apr-02 3:34
Tim Smith19-Apr-02 3:34 
QuestionReturning values from COM object ?? Pin
19-Apr-02 1:37
suss19-Apr-02 1:37 
AnswerRe: Returning values from COM object ?? Pin
Paul M Watt21-Apr-02 9:39
mentorPaul M Watt21-Apr-02 9:39 

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.