|
See, that's what I meant when I said "depending on what you mean".
You can't search a char for a string. A char is one char. A string is many. What you apparently want to do is search a string - an array of chars - for a string. In that case, you want strstr().
|
|
|
|
|
strchr(yourstring, ch) will do this. Or, if you prefer STL lifestyle, std::string::find.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi all,
I have a situation where I wish to pass a NULL to a varchar(200) parameter
of an SQL Server stored procedure using ADO and Visual C++.
I have tried various things, but with no success.
Anybody done this before?
Thanks,
Bob.
|
|
|
|
|
you can try
variant_t vtNull;
vtNull.ChangeType(VT_NULL);
and pass that. There is no constructor to make a variant NULL from the
start.
Also make sure the size parameter is 200 as your varchar is defined with a length of 200.
|
|
|
|
|
What is the difference between C and Pascal calling convention ? I have heard that pascal calling convention saves bytes - Is it true ? IF true how ?
|
|
|
|
|
The C calling convention puts the parameters on the stack from right to left, this allows the C calling convention to have an limitless parameter list like in the printf function. The caller pops parameters from the stack.
The pascal calling convention is obsolete in WIN32, but it passes its parameters from left to right.
I am not sure, but I believe that the callee pops parameters from the stack frame.
|
|
|
|
|
The pascal (stdcall) calling convention is not obsolete in Win32. Most of the Win32 API uses it. Is has various macros to describe it such as WINAPI, CALLBACK, APIPRIVATE, PASCAL, and IMAGEAPI. It is used for two reasons : first so that multiple programming languages can be supported and second because M$ claims that it is slightly more efficient. Whatever.
You are right that the callee fixes the stack. This is done by adding the number of bytes that were pushed back to ESP.
BTW: I actually do have something that resembles a life but I have spent lots of time reading .cod listings.
|
|
|
|
|
I wrote a little article on calling conventions. However, you won't find anything about Pascal calling convention. It was replaced by stdcall in Win32
I vote pro drink
|
|
|
|
|
What is the function of "PASCAL" in function declaration?
Maer
|
|
|
|
|
What's the problem? You already got answered on this yesterday
|
|
|
|
|
Sorry, I post a wrong question.
What I want to know is "FAR PASCAL"
Thanks.
Maer
|
|
|
|
|
Hi
Im using the Refresh Method With ADO C++(I had to many problems with Createparameter Method)
bstr_t bstr = L"DSN=MEAS2SQL;
pCon->Open(bstr, (BSTR)NULL, (BSTR)NULL, -1);
pCommand->ActiveConnection = pCon ;
pCommand->CommandType = ADODB::adCmdStoredProc
pCommand->CommandText = _bstr_t("URBAN");
"It works with executing a stored procedure without parameters"
But when i inlude parameters with this lines i get the error.
pCommand->Parameters->Refresh();
pCommand->Parameters("@pkMbtID") = '160';
I get the error:
error C2064: term does not evaluate to a function
I spent several hours with this Plezz Help.
PS. They say CreateParametr is Faster then Refresh Method i wonder how much faster?
|
|
|
|
|
For a working ADO VC++ example, check out my web site:
userpages.umbc.edu/~bcorfm1/software.html
Look for the PhoneList program. Although the main program is in WTL, the ADO stuff is applicable to any framework. It includes usage for passing SQL queries with parameters, running stored queries, using Refresh, etc.
Best regards,
CodeGuy
The WTL newsgroup: 880 members and growing ... http://groups.yahoo.com/group/wtl
|
|
|
|
|
Thanx but i couldn't find anything using the "Refresh Method" or the "CreateParameter Method"
/Bigge
|
|
|
|
|
I made a mistake: I know you said Refresh, but I was thinking of Update instead. Sorry. :/
Let me see if I can help you though: I think you'll find that if you're trying to pass parameters to the DB, that you'd find it easier to pass the parameters like I'm doing in the code, rather than using CreateParameter. With MS Access, you pass a string "EXECUTE Authors 'Faulkner'" where 'Faulkner' is the query parameter. If you're passing numbers, don't use the single quotes.
For SQL Server, the only change is to use the CALL command instead of EXECUTE. This is documented inside the PhoneList's DBHandler class.
Best regards,
CodeGuy
The WTL newsgroup: 880 members and growing ... http://groups.yahoo.com/group/wtl
|
|
|
|
|
here is a example with Create Parameters
_RecordsetPtr pRS ;
_CommandPtr pcmdStoredProc;
try
{
hr = pcmdStoredProc.CreateInstance(__uuidof(Command));
if(FAILED(hr))
_com_issue_error(hr);
pcmdStoredProc->ActiveConnection = <Your Connection>
pcmdStoredProc->CommandType = adCmdStoredProc;
pcmdStoredProc->CommandText = _bstr_t("<Stored Proc Name>");
_ParameterPtr param;
_variant_t vtReturnVal(0L);
_variant_t vtReturnVal2(0L);
param = pcmdStoredProc->CreateParameter(_T("<Param 1 Name>"),adInteger,adParamOutput,sizeof(long),vtReturnVal);
pcmdStoredProc->Parameters->Append(param);
param = pcmdStoredProc->CreateParameter(_T("<Param 2 Name>"),adInteger,adParamOutput,sizeof(long),vtReturnVal2);
pcmdStoredProc->Parameters->Append(param);
param = pcmdStoredProc->CreateParameter(_T("<Param 3 Name>"),adInteger,adParamInput,sizeof(long), _variant_t((long)10));
pcmdStoredProc->Parameters->Append(param);
param = pcmdStoredProc->CreateParameter(_T("Param 4 Name>"),adInteger,adParamInput,sizeof(long), _variant_t((long)-1));
pcmdStoredProc->Parameters->Append(param);
pRS = pcmdStoredProc->Execute(NULL, NULL, adCmdStoredProc);
}
catch(_com_error& e)
{
CString sBuff = GetErrorDescription(e);
AfxMessageBox(sBuff);
return;
}
catch(...)
{
AfxMessageBox("Unknown Error Occured");
return;
}
|
|
|
|
|
Hi.
Help me to use database in dialog base program.
Iman Ghasr-e-fakhri
|
|
|
|
|
Hi.
what can I do to maneging mouse move event on buttons.
Iman Ghasr-e-fakhri
|
|
|
|
|
What are you asking ? WM_MOUSEMOVE is called when you move the mouse, and WM_LBUTTONDOWN/UP/etc are called when you press a button. To tell if a button is down as the mouse is moved you can use GetAsyncKeyState(VK_LBUTTON). You should call it twice, once to clear the buffer and once to check if it's down now, like so
GetAsyncKeyState(VK_LBUTTON); // may return true because it was down since the last check
if (GetAsyncKeyState(VK_LBUTTON))
// NOW we can do something
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Hi.
What can I do to chenge Edit Box (with CEdit) text color & BackGround color
Iman Ghasr-e-fakhri
|
|
|
|
|
How can I set a CEdit box up such that the enter key must be pressed before an OnChangeEdit Msg is generated? That is, the user must press enter before the edit box data is processed.
Thanks.
Richard
|
|
|
|
|
Hi My friends.
I want to use MFC Singel Document
to Type Equetio with "Breaking line" or "fraction line"
......2
....5x + 6
z=.--------
.....2y
(I don't know use this words corect or not) like this
I nead draw line and text together.
what can I do to have "Cursor" to type text & able to draw line .
Iman Ghasr-e-fakhri
|
|
|
|
|
Nothing - Windows is a graphical system - you can accept text and draw it into the view, and you can draw a line on the view as well.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
In MS Word 97, when I drag any toolbar (such as drawing toolbar) and drop it on the Word window, it becomes a window with small title bar, when I click on a button on the toolbar, the cursor on MS Word window still blink and MS Word window is still active. Vice versus, when I type, the toolbar window is still active. I try to create a window like that by the API Fuction CreateWindowEx and set window style as WS_Ex_TOOLWINDOW, and its parent as another window;
However, this window becomes de-active when I click on its parent window. I wish to receive any explaination for this phenomenon. Thank you very much.
|
|
|
|
|
I have a question that's realy bothering me.
when I look at the forums question and answers,
I see that the text is on a blue background and sometimes an example code on an orange background.
How do you do that ????
Name: STR
BTW: for some of you that wished for CodeProject irc server
I create a channle on DalNet called "#CodeProject"
|
|
|
|