Click here to Skip to main content
15,895,709 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralUploaded Files Get Locked for ~ 30 seconds Pin
Angus Logan17-Oct-02 19:24
Angus Logan17-Oct-02 19:24 
GeneralRe: Uploaded Files Get Locked for ~ 30 seconds Pin
Vasudevan Deepak Kumar29-Oct-02 2:26
Vasudevan Deepak Kumar29-Oct-02 2:26 
GeneralSalamander .NET Protector Pin
Patrick Lassalle17-Oct-02 1:57
Patrick Lassalle17-Oct-02 1:57 
GeneralRe: Salamander .NET Protector Pin
Derek Lakin17-Oct-02 23:43
Derek Lakin17-Oct-02 23:43 
GeneralRe: Salamander .NET Protector Pin
Patrick Lassalle17-Oct-02 23:47
Patrick Lassalle17-Oct-02 23:47 
GeneralRe: Salamander .NET Protector Pin
Derek Lakin18-Oct-02 3:55
Derek Lakin18-Oct-02 3:55 
GeneralRe: CLickety Pin
Daniel Turini21-Oct-02 4:36
Daniel Turini21-Oct-02 4:36 
GeneralHeeeeeeeeeeelp: CString and /clr Pin
Doug16-Oct-02 12:51
Doug16-Oct-02 12:51 
Hi Folks

Re: ADO.NET : SqlDataReader : I need to assign retrieved value to C++ variable

I have found the source of the problem expressed in the thread "ADO.NET : SqlDataReader : I need to assign retrieved value to C++ variable":
http://www.codeproject.com/script/comments/forums.asp?forumid=3785#xx309754xx

but do not yet know why it occurs or how I can fix it.

The problem arises with the /clr compiler setting.

Here is the code to illustrate this:

/////////////////////////////////////////////////////////

#include <stdafx.h>
#include <cstdlib>
#include "try_ADONET.h"

//#using <mscorlib.dll>
//#using <system.dll>
//#using <system.data.dll> // This is required for the ADO.NET Provider

using namespace std;
//using namespace System;

int Main()
{
CString busNumberSQL[2];
CString bus = "Hello";
busNumberSQL[1] = bus;

return 0;
}

////////////////////////////////////////////////////////

Without the /clr setting the array of CString busNumberSQL[2] is correctly contructed as is CString bus and the line

busNumberSQL[1] = bus;

works as expected. This can be seen by putting a breakpoint in at

return 0;

and seeing the variables in a Watch. Copy the expanded Watch details (Name, Value & Type) to an EXCEL sheet.
..................

Next, add the compiler switch /clr and rerun the code.

CString bus is constructed correctly BUT something weird happens in the construction of CString busNumberSQL[2].

Now,
busNumberSQL[1] = bus;

results in the address of bus as an integer being assigned to busNumberSQL[1], and look at the Watch details!!

Copy the expanded Watch details (Name, Value & Type) to an EXCEL sheet

Name: busNumberSQL; Value: {Length=2}; Type: ATL::CStringT<char,strtraitmfc<char,atl::chtraitscrt<char> > >[] ...(Note no dimension at end compared to the "no /clr" case.
Next Watch line: [0] 2083454756 __int32
Next Watch line: [1] 3103464 __int32

My conclusion is that busNumberSQL[2] is not an array of CString.

Of course, I need the /clr in order to use ADO.NET!

It seems as though a CString works, but a CString array for some (unknown) cannot even be defined.

Do you have any light for me? (I have not got into your previous post yet on Marshall)

Best regards

Doug.

(In case you are wondering I am very much a beginner with C++ and .NET)




Doug
GeneralRe: Heeeeeeeeeeelp: CString and /clr Pin
David Stone16-Oct-02 13:22
sitebuilderDavid Stone16-Oct-02 13:22 
GeneralRe: Heeeeeeeeeeelp: CString and /clr Pin
Doug16-Oct-02 13:48
Doug16-Oct-02 13:48 
GeneralRe: Heeeeeeeeeeelp: CString and /clr Pin
David Stone16-Oct-02 14:08
sitebuilderDavid Stone16-Oct-02 14:08 
GeneralRe: Heeeeeeeeeeelp: CString and /clr Pin
David Stone16-Oct-02 15:16
sitebuilderDavid Stone16-Oct-02 15:16 
GeneralRe: Heeeeeeeeeeelp: CString and /clr Pin
Paul Riley16-Oct-02 21:32
Paul Riley16-Oct-02 21:32 
GeneralRe: Heeeeeeeeeeelp: CString and /clr Pin
Doug17-Oct-02 11:29
Doug17-Oct-02 11:29 
GeneralRe: Heeeeeeeeeeelp: CString and /clr Pin
David Stone23-Oct-02 16:24
sitebuilderDavid Stone23-Oct-02 16:24 
General.NET and Mac OS Pin
Orion Buttigieg16-Oct-02 11:17
Orion Buttigieg16-Oct-02 11:17 
GeneralRe: .NET and Mac OS Pin
Stephane Rodriguez.16-Oct-02 11:57
Stephane Rodriguez.16-Oct-02 11:57 
GeneralRe: .NET and Mac OS Pin
David Stone16-Oct-02 12:20
sitebuilderDavid Stone16-Oct-02 12:20 
GeneralRe: .NET and Mac OS Pin
ez216-Oct-02 12:25
ez216-Oct-02 12:25 
GeneralRe: .NET and Mac OS Pin
Orion Buttigieg16-Oct-02 13:19
Orion Buttigieg16-Oct-02 13:19 
GeneralRe: .NET and Mac OS Pin
Stephane Rodriguez.16-Oct-02 19:02
Stephane Rodriguez.16-Oct-02 19:02 
GeneralRe: .NET and Mac OS Pin
Anonymous18-Oct-02 17:04
Anonymous18-Oct-02 17:04 
GeneralRe: .NET and Mac OS Pin
Stephane Rodriguez.18-Oct-02 19:28
Stephane Rodriguez.18-Oct-02 19:28 
GeneralInstaller problem with c++.net Pin
AnTri16-Oct-02 9:38
AnTri16-Oct-02 9:38 
GeneralHBITMAP problem (interop)... Pin
Anonymous15-Oct-02 5:08
Anonymous15-Oct-02 5:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.