Thanks a lot! I'll try that out :)
sirtimid
Posts
-
Memory leak problem. -
Memory leak problem.Hi all. I have a memory leak on a C++ MFC app I'm trying to solve. In the problematc part of code there are some function calls as follows: void functionA() { functionX(new ClassConstructor()); } Since this unmanaged code, is it safe to do that without freeing the memory allocated by the new operator, or it will be released after exiting the functionA scope? Shouldn't be something like the following a good solution? void functionA() { ClassConstructor *obj = new ClassContructor(); functionX(obj); delete obj; } Thanks in advance :)
-
How to detect a winsock connection lostI'm using the winsock API in my VC++ 2008 app. When the application is running and the socket is connected all the time reading/writing, I unplug the network cable to force a network problem. In order to check if the connection is down I just send 0 bytes to the socket, but I still returns 0 instead of SOCKET_ERROR. Does anyone know how to check if the connection is down?
-
Batch update in SQL Server DatabaseYes maybe you are right. I have tried I think everything else. So I'll try this solution. Thank you very much for your help Rob :)
-
Batch update in SQL Server DatabaseThank you Rob, Actually my stored procedure has a double functionality. Updates rows in my table (depending on a key) and in case of non existing rows it inserts them. I haven't tried to bulk insert in a temp table and after update mine because I have to do this many times and I'm afraid that it would be realy time consuming to do this every time, because every time I should delete the temp table. That's why I would like to fill somehow a datatable in the memory and after my insert/update queries (maybe without using stored procedure) to update this in the db. Thanks again, Dimitris
-
Batch update in SQL Server DatabaseHello all, I have a windows application which updates multiple rows (using a stored procedure in the db) in a SQL Server database, but this updates run many times sequentially in a for loop. For the update methos I have tried the following methods: - The SqlCommand object running my stored procedure as a text commnand and executing it with the ExecuteNonQuery method. - An SqlDataAdapter using its UpdateCommand attribute and executing using the ExecuteNonQuery method. In both ways the running time is really slow. Can anyone suggest me an other way to do the updates. It would be good if I could save my updates n a dataset or a datatable and after save it to the db. Thanks in Advance Dimitris
-
ODBC connection string for SQL Server 2005As much as I see, there is no argument with unspecified value. They all have a valid value.
-
ODBC connection string for SQL Server 2005Yes I have...the error was in line: AFX_SQL_SYNC(::SQLDriverConnect(m_hdbc, hWnd, (UCHAR*)T2A((LPTSTR)(LPCTSTR)m_strConnect), SQL_NTS, szConnectOutput, _countof(szConnectOutput), &nResult, wConnectOption)); in the Connect function of CDatabase class.
-
ODBC connection string for SQL Server 2005I have an application developed on VS6 that I used to connect to an SQL Server 2000 without problem. Due to some system upgrades, now I have to establish the connection to an SQL Server 2005 at the same database. The connection string remains the same: "DSN=DSN_NAME;UID=user_name;PWD=password" At the OpenEx function of the CDatabase object I get the following error: "Unhandled exception in myexe.exe (DSSENH.DLL): 0xC0000005. Access Violation." Does anyone know anything about the issue? Thanks in Advance :)
-
Binary Search TreesI have two binary tree structures shown below. The unsortedBTree has values and the sortedBTree is empty. I want to fill the sortedBTree with the values of unsortedBTree sorting them by the values of counter inserting the biggest values to the right. Can anyone please give a short sample code on how to do it without recurtion, but with a while loop? typedef struct UNSORTEDBTREE { int a[3]; int counter; unsortedBTree *left; unsortedBTree *right; unsortedBTree *parent; }unsortedBTree; typedef struct SORTEDBTREE { int a[3]; int counter; sortedBTree *left; sortedBTree *right; sortedBTree *parent; }sortedBTree; Thanks in advance! sirtimid
-
Logging on to WindowsXP with smart cardDoes anyone know how can I log on to a WindowsXP system with a GemClubMemo smart card? The PC will be connected to a domain. Thanks in advance! sirtimid
-
ODBC with VC++I mean the CPU usage. So, after plenty opens of tables I have serious memory problems!!! Thanks sirtimid
-
ODBC with VC++I'm developing an app that opens a connection to a database and makes a massive import to many tables of it. To do that I open and close the tables several times in some loop statements. The problem is that, when I open a table the service of the sql server (sqlservr.exe) increases the usage of the cpu it uses. When I close the table it should release the resources, but it doesn't! Does anyone know if there is a setting of the sql server that must be changed to do that? Thanks in advance sirtimid
-
ODBC with VC++Hi, How can I manage a Ms SQLServer Database with VC++ .NET? Thank you all!!!
-
Terminate sqlservr.exe processThis is the process that the MSSQLSERVER runs. It returned 6 (The handle is invalid. - ERROR_INVALID_HANDLE) I got the Process ID as shown below: HANDLE hProcessSnap = NULL; BOOL bRet = FALSE; PROCESSENTRY32 pe32 = {0}; hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); if (hProcessSnap == INVALID_HANDLE_VALUE) return FALSE; pe32.dwSize = sizeof(PROCESSENTRY32); if (Process32First(hProcessSnap, &pe32)) { DWORD dwPriorityClass,excd; BOOL bGotModule = FALSE; bool found = false; MODULEENTRY32 me32 = {0}; do { HANDLE hProcess; hProcess = OpenProcess (PROCESS_ALL_ACCESS | PROCESS_TERMINATE | PROCESS_QUERY_INFORMATION, FALSE, pe32.th32ProcessID); if(!memcmp(pe32.szExeFile,"sqlservr.exe",12)) { bGotModule = GetExitCodeProcess(hProcess, &excd); TerminateProcess(hProcess, excd); err = GetLastError(); found = true; } else { found = false; } CloseHandle (hProcess); } while (Process32Next(hProcessSnap, &pe32) && !found); } CloseHandle (hProcessSnap);
-
Terminate sqlservr.exe processHello everybody, Does anyone know ho can I terminate the sqlservr.exe process? I tried the TerminateProcess() but it didn't work and I guess that it must be the child processes or threads that might be running with it. So how can I terminate all the tree process? Thanks in Advance! sirtimid
-
SQL Server ServiceHello all, Does anyone know ho can I stop the MSSQLSERVER service? Thanks in Advance!
-
ODBC with VC++OK I found why this error occured. This was because in the DoFieldExchanged() I have all the fields of the table, so the Open() should be with NULL value at the second argument (LPCTSTR lpszSQL=NULL). So, I tried the following: m_pSet = new CDatabaseSet; m_pSet->m_strFilter = "ID = 48"; m_pSet->Open(CDatabaseSet::dynaset); Now the problem is that it works properly when the filter has a field of numeric type. When it is of character type it doesn't work properly. It returns the last record even if it shouldn't return anything. Any idea on why this happens??? Thanks again for your help!!!
-
ODBC with VC++Yes I already tried it. I saw that this was because in the DoFiledExchange() the first field must be of the same type with the requested one in the Select clause. Thanks very much for your time! Any idea?
-
ODBC with VC++I try to open a table "Customer" and select a specific record of it with the Open property as follows: m_pSet->Open(CCustomer::dynaset,"SELECT NAME FROM CUSTOMER WHERE ID = 5" This command throws the following exception error: "Invalid character value for cast specification" Does anyone know what have I done wrong and how to make it work properly? Thanks in advance