|
What kind of database is it, if it's sql server, maybe try to put a store procedure and then the interface should call it.
|
|
|
|
|
Hi,
I am using MS Access Database(no stored queries).I am sure the problem is not with Interface pointer as while Debugging the program works perfectly.So,pls tell me if there is problem with some other part
if the application I have mentioned .
|
|
|
|
|
Need to know a bit more. Is the component shared among threads? What threading model is being
used? Is a shared DB connection being used? One thing that springs to mind about debug ~vs~ release is the speed. As release is faster, it may be causing a problem. How does Access do
its locking, is it per row, table or block? if per table or block you may need
to synchronise access to the DB to prevent collisions.
HTH.
|
|
|
|
|
Without knowing all of the facts here is my guess:
This sounds like a classic "race" condition. The database record lock and your writes in the threads collide with each other. To prove if this is the case try adding three different, long delays to the threads (e.g. Sleep( 100 ), Sleep( 200 ), Sleep( 300 ). If this works, your database and interface is OK and you have a timing problem. You must synchronise the writes or retry on error.
Have Fun!!!
|
|
|
|
|
Hello every body,
My questio is: how can I insert in a View in a Dialog Window?
Thank you for your help
Giancarlo
Giancarlo Amati --> amati@iei.pi.cnr.it
|
|
|
|
|
What kind of View? A view as in Doc/View?
Michael
|
|
|
|
|
Yes,
I need to build a Dialog in which I would build a view to draw or write something. For example a preview o something similar.
Thank
Giancarlo
|
|
|
|
|
Have a look at http://www.codeproject.com/miscctrl/customcontrol.asp. It should give you a good starting point.
Michael
|
|
|
|
|
Chaps and fellow geeks,
I have a pointer to an array of 10 chars (note that this is different from an array of ten chars, which allocates 10 bytes, the former allocates 4 bytes). This means, whenever I increment the pointer, I can skip by 10 bytes. I then proceed to allocate 100 bytes of storage (as I want to treat it as a 10 by 10 array). Trouble is (well, not really trouble), when I use new to allocate 100 bytes for the pointer I need to typecast the pointer returned by the new operator to the type of "pointer to an array". Towards this end, I have typedefed CHARTENARRAY as a pointer to an array of 10 bytes. I then typecast the return value of new like so: pArray = (CHARTENARRAY) new char[100];
I would like to know if there is a way of doing this *without* the typedef. How would I typecast it? In general, what would be the cast for a pointer to an array of x bytes that is returned, by the new operator when it is used to allocate x bytes?
To make things clear, here is the source (with lots of comments), you can compile it and run it if you'd like to experiment:
typedef char (*CHARTENARRAY)[10]; // typedefines CHARTENARRAY to be a pointer to an array of 10 b
CHARTENARRAY pArray = NULL;
pArray = (CHARTENARRAY) new char[100]; // need to do this WITHOUT the (CHARTENARRAY) typedef.
for(int i = 0; i < 10; ++i)
{
strcpy(*pArray, "HELLO!"); // Fill in 10 "HELLO!" strings in 10 slots
++pArray; // increment by 10 bytes (scalar)
}
pArray -= 10; // Go to array start (will decrement by 100 bytes, since scalar is 10)
for(i = 0; i < 10; ++i) // Display routine
{
puts(*pArray);
++pArray; // Go to next string
}
pArray -= 10; // Go to array start
delete [] pArray; // Free
|
|
|
|
|
Don't try to do it without the typedef. Using the typedef makes the code easier to understand.
Well, ok, to answer, I think the cast would be (char (*)[10]). But honestly, only Bjarne Stroustroup would know what that means. Stick with the typedef.
--Mike--
http://home.inreach.com/mdunn/
#include "buffy_sig"
|
|
|
|
|
Won't forget that in a hurry-it works, thanx Mike. I did try (char*)[10] - this didn't work, though I thought that was intuitive Looks like the right to left rule of reading declarations might come in handy even in areas such as this!
Cheers,
Shanker.
|
|
|
|
|
#include <iostream.h>
#include <string.h>
void main()
{
char *pstr="test" ;
cout<<strrev(pstr)<<endl;
}
This program isn't executed in VC++6.0, but in C++ Builder5.0, Why?
|
|
|
|
|
#include <iostream.h>
#include <string.h>
void main()
{
char *pstr="test" ;
cout<<strrev(pstr)<<endl;
}
OK, then Borland is not comforming to C. You wrote code that is attempting to modify a constant string. _strrev actually modifies the character array/pointer, so an error occurs here because you are modifying a constant. The correct way of doing this problem would be:
#include <iostream.h>
#include <string.h>
void main()
{
char str[] = "test";
cout << _strrev(str) << endl;
}
Frank
|
|
|
|
|
Thanks, Frank.
There is another question .
The program taken from an article "A Sample Generic-Text Program" from MSDN isn't executed in VC++ 6.0 , Whether it modifies a constant string either?
#include <stdio.h >
#include <stdlib.h >
#include <string.h >
#include <direct.h >
#include <errno.h >
#include <tchar.h >
int __cdecl _tmain(int argc, _TCHAR **argv, _TCHAR **envp)
{
_TCHAR buff[_MAX_PATH];
_TCHAR *str = _T("Astring");
char *amsg = "Reversed";
wchar_t *wmsg = L"Is";
#ifdef _UNICODE
printf("Unicode version\n");
#else /* _UNICODE */
#ifdef _MBCS
printf("MBCS version\n");
#else
printf("SBCS version\n");
#endif
#endif /* _UNICODE */
if (_tgetcwd(buff, _MAX_PATH) == NULL)
printf("Can't Get Current Directory - errno=%d\n", errno);
else
_tprintf(_T("Current Directory is '%s'\n"), buff);
_tprintf(_T("'%s' %hs %ls:\n"), str, amsg, wmsg);
_tprintf(_T("'%s'\n"), _tcsrev(str));
return 0;
}
|
|
|
|
|
Because when you declare:
TCHAR* str = "blah blah";
the literal string "blah blah" is stored in the executable. When loaded into memory, that string may, at the whim of the OS, be stored in a read-only section of memory. Thus your program fails when it tries to modify the string.
--Mike--
http://home.inreach.com/mdunn/
#include "buffy_sig"
|
|
|
|
|
Same Problem.
_TCHAR *str = _T("Astring");
is a pointer to a string constant. What you really want is
_TCHAR str[] = _T("Astring");
This will store the string into an array. Therefore, it allows _tcsrev (or now _wcsrev) to modify the array. Of course, I can't say that it's "ANSI C" because this is a MS-specific type.
Heh, it seems that the sample program is trying to get away with this business. In practice, you should never modify a pointer to a constant string.
Frank
|
|
|
|
|
#include <iostream.h>
#include <string.h>
void main()
{
char *pstr = new char[5];
strcpy(pstr,"test");
cout<< strrev(pstr) <
|
|
|
|
|
How Can convert BSTR to LPCSTR OR vice versa!
|
|
|
|
|
CString does it for you - it can be constructed from a BSTR and AllocSysString returns a BSTR.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Use _bstr_t to handle conversion from BSTR to const wchar_t*/const char*. _bstr_t is part of VC6.0's compiler COM support classes. Defined in <comdef.h>.
--
Venkat
|
|
|
|
|
Define USES_CONVERSION; at the top of the method implementation you are trying to do the conversion in. then use W2T
void foo(BSTR bstrVariable)
{
USES_CONVERSION;
// conversion is done to the stack so don't delete on function exit
// and don't use pointer outside of method.
LPCTSTR pcstrVariable = W2T(bstrVariable);
// TODO: do work with string.
}
Cheers,
-Erik
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
My thoughts are my own and reflect on no other.
|
|
|
|
|
Can any one please provide me with a way to enable the inserting of tabs into a RichEdit control within a dialog based application. The rich edit control is contained within a tab control page therefore the normal action when the tab key is pressed is to tab to the next tab in the control.
|
|
|
|
|
Is there a function that can convert a CString containing a hexadecimal or octal string to an integer. atoi() only works for decimal strings.
---
Multitasking: Screwing up several things at once.
|
|
|
|
|
|