|
|
By using its replacement...?
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
it is so easy question,i am very glad to answer it
add "#pragma warning(disabled:4996)" in the head of header file and then the warning informaion will disappear.
echozeng ----->rose rose i love you
|
|
|
|
|
i'm not going to blame you because (and only because) you're new to this forum. BTW, you should avoid posting an answer if it has already been answered (especially if you don't provide much useful infos)... the #pragma solution was even quoted more than twice already, so read the other answers before replying
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
Can someone please tell me if it is possible to get the ip of a spoofed message. We are using a lan, but someone keeps on spoofing.
KOM UIT DAAAAA!!!
|
|
|
|
|
Grimes wrote: Can someone please tell me if it is possible to get the ip of a spoofed message.
What message? A broadcast message over your network, or an e-mail message?
Grimes wrote: We are using a lan, but someone keeps on spoofing.
Why would you think that a LAN would prohibit spoofing?
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
they use the 'net send' of windows. Does these messages also contain the ip of the computer they were sent from?
|
|
|
|
|
Grimes wrote: Does these messages also contain the ip of the computer they were sent from?
Not that I am aware of. They do contain the machine's name, however. Can you not just cross-reference that back to the IP address?
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
these guys use a program to change that name displayed in the message
KOM UIT DAAAAA!!!
|
|
|
|
|
Oh, I just assumed that NET SEND was being used. The only recourse that I know of is to disable the Messenger service on your machine.
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
Hi friends,
I want to know how the C++ compiler implements Inheritance,Polymorphysm concepts. Can any one of u suggest some good links .
Thanks in advance.
Appu..
"If you judge people, you have no time to love them."
|
|
|
|
|
|
See this[^] thread
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Thanks it really helped me a lot.
Appu..
"If you judge people, you have no time to love them."
|
|
|
|
|
You're welcome.
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Hi buddies i have a relativly simple question
i whant to execute a select statment in c++
but for the WHERE part of the statment i want to read it from a variable of type string
Let me be more precise.
string token;
token="SomeName"
pCommand->CommandText = "SELECT * FROM Table1 WHERE Name=?";//WHERE Name=token
Any ideas pls help
Thanks again
|
|
|
|
|
|
Hey Nibu thanks for the reply can you give me a code sample of how to use it
thanks appreciate the help
|
|
|
|
|
antonaras wrote: Hey Nibu thanks for the reply can you give me a code sample of how to use it
thanks appreciate the help
Look at what steve said. That is the right way to do it.
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
Hey Rakesh_Thakur thanks for the reply i tried what you said
i wrote you code but i get 2 errors
1.'strcat' : cannot convert parameter 1 from 'class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >' to 'char *
2.error C2664: 'PutCommandText' : cannot convert parameter 1 from 'class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >' to
'class _bstr_t'
any ideas thanks again
|
|
|
|
|
antonaras wrote: 1.'strcat' : cannot convert parameter 1 from 'class std::basic_string,class std::allocator >' to 'char *
use Obj.C_str();
antonaras wrote: 2.error C2664: 'PutCommandText' : cannot convert parameter 1 from 'class std::basic_string,class std::allocator >' to
'class _bstr_t'
use wrapper _bstr_t
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
What you really need is a parameterised query. The idea is that you create a parameter, and associate it with the command object.
You can then fill in the value, and run the command. Check out the documentation for CreateParameter.
This is preferred to concatenating the text because it avoids problems with strings containing quotes, and the so-called SQL injection attacks.
Steve S
Developer for hire
|
|
|
|
|
Hey Steve allways appreciate the help (again )
I hope i'm not asking much but can you give me an example
|
|
|
|
|
 This isn't pretty, nor is it optimal, but it covers the basics; You'll want to reindent the code, and I do things a little differently, by using raw interfaces when importing.
Where there is a call to doQuery, you can put so UI in there to ask for & validate a query field. This is a bit rough in places, normally I use OLE DB rather than ADO, but it works. You'll need to change the name of the data source (obviously).
The trick is to create the parameter and associate it with the command object. You can then use Execute to get a recordset, and having done that, you can ask the recordset to requery without needing the command object (once you've changed the parameter value. Add a different call to doQuery with a different string below the first one, and you'll see what I mean.
The advantage over straight SQL text building is that in many cases, the SQL needs to be parsed only once, which is handy for complex queries, and in addition, it protects you from some nasty so-and-so from performing a SQL injection attack.
(Yes, it was asking a bit much, but I had a spare 10 minutes at lunchtime[local time])
<br />
#include <windows.h><br />
#include <tchar.h><br />
#include <ole2.h><br />
#import "c:\Program Files\Common Files\System\ADO\msado15.dll" \<br />
no_namespace rename("EOF", "EndOfFile") raw_interfaces_only<br />
#include <stdio.h><br />
#include <conio.h><br />
<br />
<br />
void printRows(_Recordset* pRstTemp)<br />
{<br />
VARIANT_BOOL bEOF;<br />
pRstTemp->MoveFirst();<br />
<br />
pRstTemp->get_EndOfFile(&bEOF);<br />
if (bEOF)<br />
{<br />
_tprintf(_T("\tRecordset empty\n"));<br />
}<br />
else<br />
{<br />
_bstr_t bstrTitle;<br />
_bstr_t bstrType;<br />
<br />
while(!bEOF)<br />
{<br />
FieldsPtr spFields;<br />
FieldPtr spField;<br />
long nFields;<br />
pRstTemp->get_Fields(&spFields);<br />
spFields->get_Count(&nFields);<br />
for(long f = 0; f < nFields; f++)<br />
{<br />
BSTR t = NULL;<br />
<br />
spFields->get_Item(_variant_t(f), &spField);<br />
_variant_t v;<br />
spField->get_Value(&v);<br />
spField->get_Name(&t);<br />
if (v.vt != VT_NULL)<br />
{<br />
v.ChangeType(VT_BSTR);<br />
#ifdef _UNICODE<br />
_tprintf(_T("%20.20s: %s\n"), (LPCWSTR)t, (LPCWSTR)v.bstrVal);<br />
#else<br />
_tprintf(_T("%20.20S: %S\n"), (LPCWSTR)t, (LPCWSTR)v.bstrVal);<br />
#endif<br />
}<br />
else<br />
{<br />
#ifdef _UNICODE<br />
_tprintf(_T("%20.20s: (null)\n"), (LPCWSTR)t);<br />
#else<br />
_tprintf(_T("%20.20S: (null)\n"), (LPCWSTR)t);<br />
#endif<br />
}<br />
SysFreeString(t);<br />
spField = NULL;<br />
}<br />
_tprintf(_T("\n"));<br />
pRstTemp->MoveNext();<br />
pRstTemp->get_EndOfFile(&bEOF);<br />
}<br />
}<br />
}<br />
<br />
void doQuery(_CommandPtr& pCmd, _RecordsetPtr& pRS, _ParameterPtr& pParam, LPCTSTR custid)<br />
{<br />
HRESULT hr;<br />
pParam->put_Value(_variant_t(custid));<br />
if (pRS==NULL)<br />
{<br />
hr = pCmd->Execute(NULL,NULL,0,&pRS);<br />
}<br />
else<br />
{<br />
hr = pRS->Requery(0);<br />
}<br />
if (SUCCEEDED(hr))<br />
{<br />
printRows(pRS);<br />
}<br />
}<br />
<br />
void doSample()<br />
{<br />
HRESULT hr;<br />
_ConnectionPtr spConn;<br />
_CommandPtr spCommand;<br />
_RecordsetPtr spRS;<br />
_ParameterPtr spParam;<br />
ParametersPtr spParamSet;<br />
_variant_t custid;<br />
<br />
hr = spConn.CreateInstance(__uuidof(Connection));<br />
if (SUCCEEDED(hr))<br />
{<br />
_bstr_t empty(_T(""));<br />
_bstr_t sample(_T("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=nwind.mdb"));<br />
hr = spConn->Open( sample, empty, empty, adModeUnknown);<br />
if (SUCCEEDED(hr))<br />
{<br />
hr = spCommand.CreateInstance(__uuidof(Command));<br />
if (SUCCEEDED(hr))<br />
{<br />
spCommand->put_CommandText(_bstr_t("SELECT * FROM customers WHERE CustomerID = ?"));<br />
spCommand->put_Prepared(VARIANT_TRUE);<br />
spCommand->putref_ActiveConnection(spConn);<br />
hr = spCommand->Execute(NULL,NULL,adCmdText, &spRS);<br />
hr = spCommand->get_Parameters(&spParamSet);<br />
spParamSet->Refresh();<br />
hr = spCommand->CreateParameter(NULL,adBSTR,adParamInput,NULL,custid,&spParam);<br />
spParamSet->Append(spParam);<br />
<br />
doQuery(spCommand, spRS, spParam, _T("ALFKI"));<br />
}<br />
else<br />
{<br />
_tprintf(_T("Unable to create command [HR=0x%8lX]\n"),hr);<br />
}<br />
spConn->Close();<br />
}<br />
else<br />
{<br />
_tprintf(_T("Unable to open connection [HR=0x%8lX]\n"),hr);<br />
}<br />
}<br />
else<br />
{<br />
_tprintf(_T("Unable to create connection object [HR=0x%8lX]\n"), hr);<br />
}<br />
}<br />
<br />
<br />
int main(int argc, char**argv)<br />
{<br />
if (SUCCEEDED(CoInitialize(NULL)))<br />
{<br />
doSample();<br />
CoUninitialize();<br />
}<br />
return 0;<br />
}
Steve S
Developer for hire
|
|
|
|
|
Try to use a temp string for the query
string token;
token = "SomeName";
string query;
query = "SELECT * FROM Table1 WHERE Name=" + token;
pCommand->CommandText = query.data()
codito ergo sum
|
|
|
|