|
u do not need any user assistance while u r copying data from table to another, just create two databases variables and open both ODBCs then connect to both sender record set and receiver record set, start copying from sender to receiver, easy....
u can use your own overloaded RecordSet classes or simply and more than enough MFC RecordSet class...
|
|
|
|
|
Hi Friend,
From what i understood after reading ur mail, i wrote the following code for my application....................
//NOTE: 'CCustomer' is CRecordset derived class of 'Customer' table in SQL Server; 'GetConnectionStr' is my function which returns the CString on the Connection String.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
CDatabase m_dbMaster;
CDatabase m_dbField;
m_dbMaster.OpenEx(_T(GetConnectionStr(MASTERDSN)),CDatabase::openReadOnly)
m_dbField.OpenEx(_T(GetConnectionStr(FIELDDSN)),CDatabase::noOdbcDialog)
m_dbField.BeginTrans();
CCustomer m_recFieldCustomer(&m_dbField);
CCustomer m_recMasterCustomer(&m_dbMaster);
m_recMasterCustomer.Open(CRecordset::snapshot,_T("SELECT * FROM Customer"),CRecordset::readOnly);
m_recFieldCustomer.Open(CRecordset::dynamic,"SELECT * FROM Customer",CRecordset::none);
m_recFieldCustomer=m_recMasterCustomer;//Copying the Master recordset to Field recordset
m_recMasterCustomer.Close();
m_recFieldCustomer.Close();
m_dbField.CommitTrans();//COMMIT TRANSACTION FOR THE FIELD DATABASE
m_dbMaster.Close();
m_dbField.Close();
>>>>>>>>>>>>>>>>>>>>>>
Result: When i try to Compile the above code it gives error :
" 'CCustomer' : 'operator=' function is unavailable"
If you think i need to change my code or u have any other issues , please let me know. i would clarify them.
waiting for ur reply..........
Regards,
Prax.
|
|
|
|
|
yes sure, it is obvious that operator = is not overloaded in CRecordSet, all what u have to do now, is to create one function where you assign the master recordset values to the receiver recordset
for example your master table A has CustomerRef ,customerName etc...
all what u have to do is
ReceiverRecordSet.CustomerRef = MasterRecordset.CustomerRef
make sure you are assigning the right fields... Voila...
do not forget while (!masterRecordSet.ISEOF()) etc...
|
|
|
|
|
OK, i got what u meant to say... OK , is there any other way to move the entire table to the remote sql server in just one command .... like 1) using BCP utility & 2)using BULKINSERT... BUT here i am facing some issues ..
1) while using BCP utility , i am not able to handle any exceptions, and also i cannot include it between BEGINTRANSACTION --- COMMITTRANSACTION of CDatabase Object.
it wil show up a console window when v use BCP. and if there is a network failure while tranfering data then the window wil remain constant , the user has to cancel it , then only next line of code will be executed.
2) when i am using BULKINSERT , which is meant to move DATA from a 'file' TO 'SQL SERVER', but i cannot use BULKINSERT to move data from 'SQL SERVER' to 'file'.
SO that is half done with BULK INSERT.
SO IF u have any idea for how to move data between two servers, similar to Import/Export wizard in SQL SERVER Enterprise manager , please help.
Regards,
Prax.
-so radih9999, whats ur real name, what u do & where u dwell?
|
|
|
|
|
in CDatabase class there is one ExecuteSQL(CString) command... In CString u can say
"Insert into targetTable (F1,F2,etc..)
Select Master.F1,Master.F2 from Master" soooooooo simple...
My Name is Rabih and I am lebanese with CCE grade and 4 years of C++,MFC,GDI+ etc... experience
|
|
|
|
|
I did something like that before. What I did was create a DTS package in my SQLServer database and saved it. Then I called ShellExecute() on the Dtsrun.exe and sent it in the appropriate string for servername, password,etc. Here's an example (items in bold will have to be replaced by your appropriate values):
ShellExecute(NULL,"open","dtsrun.exe","/S SERVERNAME /U USERNAME /P PASSWORD /N PACKAGENAME",NULL,SW_HIDE);
So I think I set up the export in SQLServer, then opted to save it as a package, then BAM! I think that was a lot easier. Plus, the server is doing the work for you.
Who are all these people and what are they doing in my house?...Me in 30 years, inside a grocery store
bdiamond
|
|
|
|
|
Hi Guys,
The 'shellexecute' one is good , but how to call it from vc++ application, please give me step by step details for the whole process. AND can v handle exceptions for 'shell execute' and can it be kept between BEGIN & COMMIT TRANSACTION of CDatabase Object?
And Ribah, how can v refer to the table(F1,F2...) name on a remote server in "INSERT INTO (.F1,F2.......)......." please explain.
hey guys please take ur valuable time and help me one last time. if i can do this , my biggest task in my project wil be done.
Waiting for ur reply..........
Regards
Prax
|
|
|
|
|
i have 2 class a and b like this:
//heder file a
#include "b.h"
class a
{
b objb;
}
//heder file b
#include "a.h"
class b
{
a obja;
}
vc++ can not complie these codes
please tell me how can i do that?
|
|
|
|
|
u cannot do this even if it compiles, object are wrong, just create a parent object class for both and inherite a & b classes from it then u publish an Object variable in both classes and on runtime u cast it to whatever u want...
|
|
|
|
|
Try store not objects, but pointers:
<br />
<br />
class b;<br />
class a<br />
{<br />
b* pObja;<br />
}<br />
<br />
<br />
class a;<br />
class b<br />
{<br />
a* pObja;<br />
}
|
|
|
|
|
My friend and I are working on a game that will be put on web as a shareware, much like the original Doom. However, how do we generate a CD-key everytime a customer register? Anyone has done this before?
Thanks
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
Try looking for "software dongle" in google. There are some free stuffs in there.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Dear programmers,
I am capturing audio PCM with 8-bit and 16-bit from DirectSound.
As you see below zero values are 128 for 8-bit and 0 for 16-bit.
BITS VALUE RANGE ZERO VALUE
---- ----------- ----------
8-bit 0 to 255 128
16-bit -32768 to +32767 0
Recently, I examined captured audio data sream for both 8 and 16 bits and I notify a strange result.
When I capturing 8-bit audio the audio signal is oscilation near the 0x80 (128). It is OK.
But, when I capture 16-bit audio PCM; the data is oscilating periodically from 0 to 0xffff. I copy/paste below 22050 KHZ 16-bit MONO audio PCM which is captured from microphone[ there is no high volume noise or sound source while recording]. The PCM data is consist of only air & EM noise. But there are peaks near the 0xFFFF, it is not normal. What may cause to this high amplitude audio peaks.
I tried this with two different SoundBlaster but nothing has changed.
What may offer you.
Thanks and best regard.
ff f0 (peak)
00 14
00 1e
ff eb (peak)
00 16
00 2c
ff f8 (peak)
00 1a
ff fe (peak)
00 11
00 07
ff e4 (peak)
00 13
00 04
ff ea (peak)
00 0c
00 40
00 2d
00 15
00 15
00 08
00 1b
00 0c
00 0e
00 1d
ff ff (peak)
|
|
|
|
|
I need to load a csv file into mdb in my code.
I think the fastest way to do it is using bulk update of records, but although the msdn indicates it is possible to update bulk rows of data using SQLSetPos,I can't find an example of such code.
Can any one help ?
|
|
|
|
|
|
Hello everyone,
An error occur when I debug the follow codes,please help me tofind the errors,Thanks!
DDSURFACEDESC2 ddsd;
LPDIRECTDRAWSURFACE4 g_pDDSBack = NULL;
//DirectDraw back surface
HRESULT hRet;
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags= DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH |
DDSD_PIXELFORMAT | DDSD_BACKBUFFERCOUNT;
ddsd.ddsCaps.dwCaps = DDSCAPS_OVERLAY |
DDSCAPS_VIDEOPORT |
DDSCAPS_SYSTEMMEMORY|
//DDSCAPS_VIDEOMEMORY |
DDSCAPS_FLIP |
DDSCAPS_BACKBUFFER |
DDSCAPS_COMPLE
FALSE;
ddsd.dwBackBufferCount = 1;
ddsd.dwWidth =g_SurfWidth;
ddsd.dwHeight =g_SurfHeight*g_Factor;
ddsd.ddpfPixelFormat.dwFlags = DDPF_FOURCC;
ddsd.ddpfPixelFormat.dwFourCC=mmioFOURCC
('Y','U','Y','V');
Line1:
hRet = g_pDD->CreateSurface(&ddsd, &g_pDDSBack, NULL);
Note :
g_pDD is a created LPDIRECTDRAW4 vairable
Add I have checked the value of g_pDD.
It's not zero!
g_SurfWidth,g_SurfHeight,g_Factor are all initialzed!
but When I excute the program g_pDDSback is zero!
why?
Is there some errors at the setting of ddsd?
free like a bird
|
|
|
|
|
You've not told us what this code snippet is doing. What value does hRet have after calling CreateSurface() ?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Sorry!I forget!
After calling CreateSurface()
hRet=DDERR_NOOVERLAYHW;
Is that means display doesn't support overlay surface?
Thanks!
free like a bird!
|
|
|
|
|
Guoguor wrote:
Is that means display doesn't support overlay surface?
Correct, no overlay hardware is present or available.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I’m about to distribute an ActiveX and would like to register it. How do I do in an easy way (easiest possibly).
Is it free to do it?
All tips are welcomed!
_____________________________
...and justice for all
APe
|
|
|
|
|
You have to buy some certificate from VeriSign or Thawte or any other public certificate authority (which is included in the list of Trusted Root Certificates in IE) and then use tools from the SDK as described for signing the files.
The certificate is unfortunatelly not free
|
|
|
|
|
Hi there,
I'm developing an ActiveX control, for that I need to pass CPoint array to an Automation Member. So Can Anyone say How to Convert from CPoint* to VARIANT FAR.
TIA
-------------------
Rajesh Parameswaran
|
|
|
|
|
hi all,
I have a Method like this:-
void CMyprogramDlg::Addcustomers(BSTR bstrParty)
{
CListBox m_lbParties;
_ASSERTE( bstrParty != NULL);
m_lbParties.AddString(bstrParty);
}
But when I compile this,I am getting such a Error:-
"error C2664: 'AddString' : cannot convert parameter 1 from 'unsigned short *' to 'const char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
"
How do I solve this?
If anyone know this please help me..
Thanks in Advance..
|
|
|
|
|
Add string requires the char* and you are suplying the BSTR here.
You need to convert it from UNICODE BSTR to the normal string or force the listbox to accept BSTRs
|
|
|
|
|
You could use CString to convert from UNICODE to char string like this: m_lbParties.AddString(CString(bstrParty)) or use WideCharToMultiByte function. You must also create list box before you call AddString .
Regards,
Andrzej Markowski
|
|
|
|