|
You can create the DSN at runtime and then destroy it. See my reply[^] to another question.
Pavel
Sonork 100.15206
|
|
|
|
|
See Connecting to SQL Server Technical article in MSDN. It has a paragraph DSN-less Connections.
Pavel
Sonork 100.15206
|
|
|
|
|
|
Outch, yes, I know this. Should have read the question more thoroughly
Pavel
Sonork 100.15206
|
|
|
|
|
After executing a query we obtain results in the recordset object. Can any one tell me that how can we know the total number of records in RecordSet object, and how do we retrieve this value ???
|
|
|
|
|
Hi,"what i call to you"
r u tried like this?
int nCount=0;
nCount=RecordsetPointer->GetRecordCount();
anju
|
|
|
|
|
Not worked like that
|
|
|
|
|
hi,
Try like this
//Open the Recordset object by using adOpenStatic CursorType then it gives the record count
pRecordset->Open("myTable",
_variant_t((IDispatch*)pConnection,true),
adOpenStatic, adLockPessimistic,adCmdTable);
long nCount=0;
nCount=pRecordset->GetRecordCount();
CString strRCount;
strRCount.Format("%ld",nCount);
AfxMessageBox(strRCount);
anju
|
|
|
|
|
How do I set a COleDateTime Object which is set to the current time to 5 minutes ahead of the current time.
Taking care of cases like 12th hour, 59 seconds. dates like 31st etc.
|
|
|
|
|
COleDateTime ct = COleDateTime::GetCurrentTime();
COleDateTimeSpan ts(0, 0, 5, 0);
ct += ts;
Pavel
Sonork 100.15206
|
|
|
|
|
#include <stdio.h>
#include <stdlib.h>
int main()
{
int nFibo = 0;
int *FiboArray;
int loop = 0;
printf("How many Fibonacci numbers do you want to see?\n");
scanf("%d", &nFibo);
if (nFibo == 0)
exit(0);
else
{
FiboArray =(int *)malloc(nFibo);
if( FiboArray == NULL )
printf( "Insufficient memory available\n" );
else
{
printf("0 1 ");
FiboArray[0] = 0;
FiboArray[1] = 1;
for (loop = 2; loop < nFibo ;loop ++)
{
FiboArray[loop] = FiboArray[loop-1] + FiboArray[loop-2];
printf("%d ", FiboArray[loop]);
}
printf(" \n");
}
free(FiboArray);
return (0);
}
}
<\p>
//Hi all, This little program gives me a run time error at the line that has free(FiboArray)
Does anyone know what the problem is?
thanks
|
|
|
|
|
two things :
1.
what if nFibo is 1?
FiboArray[1] = 1;
this will write outside the array.
2.
when you use malloc, you have to take into account the size of the objects you are allocating. malloc allocates BYTEs, not objects. so, to allocate nFibo int's, use malloc(nFibo * sizeof(int).
-c
Greenspun's Tenth Rule of Programming:
"Any sufficiently complicated C or Fortran program contains an ad-hoc, informally-specified bug-ridden slow implementation of half of Common Lisp."
|
|
|
|
|
In addition to Chris' suggestions, you need to allocate nFibo+1 elelents.
FiboArray[0] is element #1
FiboArray[1] is element #2 so minimum allocation is 2 = (nFibo=1) + 1 (like Chris said)
FiboArray[2[ is element #3 so minimum allocation is 3 = (nFibo=2) + 1
& etc.
|
|
|
|
|
The computer user can log on Win2000 as an administrator, while
he should be forbidden to change the system time under windows 2000.
Of course we can carry this point by setting the "User Rights Assignment"
through the "Domain Controller Security Policy" tool, but how can we gain
this end through VC programing?
|
|
|
|
|
Are you asking how to prevent the system administrator from adminstering the system? Why not have the user logon as something other than Administrator? Even if you do this, what keeps the Administrator from simply resetting the right manually? (Or does it not matter).
You can post messages to any window. So if you can get the the gui of the tool you need opened, you can send messages to it and any controls in it. That gives your program control of the tool.
|
|
|
|
|
Thank you for your reply.
I am working for a special system. The user must logon as an administrator, and he can access "command console" only.
How to prevent him from changing the system time then?
|
|
|
|
|
I think you will need to set the rights using the Domain Controller Security Tool, you mentioned in your original post. I'm not familiar with that tool, but if you can figure out how to launch it from your program, if you can get the the gui of the tool you need opened, you can send messages to it and any controls in it. That gives your program control of the tool.
|
|
|
|
|
Thank you again.
You are right that I can set the rights by using the tool([Start]-[Programs]-[Administrate tools]-[Local Security Policies]-[Security Setting]-[Local Policies]-[User Rights Assignment]). I just want to restrict the user in an unvisible or hidden process. That is, we should not see the gui of the tool. How to implement it throught VC programing?
|
|
|
|
|
Hi All,
I am sending data over a (supposedly) blocking socket in a while loop but having trouble. The code works fine if I single step through code, data is sent properly, the but send fails on WSAECONNABORTED when running full speed. I am using the Dundas socket wrapper functions but tracing into the source doesn't show anything suspicious.
Anybody have any ideas?
Robert Boll
|
|
|
|
|
Do you send data to a server you designed or a public server?
If you designed the server, then you should check your server code.
Kuphryn
|
|
|
|
|
Its much easier to find the problem when you are looking in the right place.
Thanks so much.
Robert.
|
|
|
|
|
Does the server recieve data in Big Endian or little Endian. If I recall correctly, the byte order for MFC is little Endian, but if you are connecting to a Unix box or a Mac they might expect to recieve the data in Big Endian byte order.
|
|
|
|
|
I put a bitmap on my dialog box as a background, but it is covering the buttons. Is there anyway to send the bitmap back so the buttons are in front in VC++ 6.0 ? Thanks in advance friends, and C++ experts!
|
|
|
|
|
Draw the bitmap yourself in WM_ERASEBKGRND. There are exampes here on CP.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|