|
I have more or less the same problem...
I have an unmanaged array of floats, for example "float p[x][y]" and i want to convert it to something managed... how should i do it????
Thanks in advance!
|
|
|
|
|
You will want to use members of System.Runtime.InteropServices.Marshal class for many managed to unmanaged and vice-versa conversions.
|
|
|
|
|
I have the following code that I am compiling into an assembly, it compiles fine and when I debug and step through it my i variable is always 0, however when I run the same query in SQL Query Analyzer I get a value of 1130, does anyone have any ideas as to what I am doing wrong here?
int mcpp::MyNumber::GetWebStat()
{
SqlConnection* mySQLConnection;
SqlCommand* sqlCommand;
SqlDataReader* dr;
String* sql;
int i;
try
{
sql = "select count(*) as myCount from site_stats";
mySQLConnection = new SqlConnection(S"server=Nick;database=DeveloperNotes;Integrated Security=yes;");
mySQLConnection->Open ();
sqlCommand = new SqlCommand(sql, mySQLConnection);
dr = sqlCommand->ExecuteReader();
i = Convert::ToInt32(dr->Item["myCount"]);
return i;
}
catch(Exception* e)
{
Console::Write(e->ToString());
}
__finally
{
mySQLConnection->Close();
}
}
Nick Parker
May your glass be ever full.
May the roof over your head be always strong.
And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
|
|
|
|
|
Did you try the same program with C#, just making sure that there is no logical errors.
Cheers
Kannan
|
|
|
|
|
Kannan Kalyanaraman wrote:
Did you try the same program with C#, just making sure that there is no logical errors.
Good idea, I am not sure and will check when I get home.
Nick Parker
|
|
|
|
|
Until u say
Reader->Read(),
the pointer will not go to the first record so that's the reason u are getting 0.
try this
while(Reader->Read)
{
// your code.
}
|
|
|
|
|
Thank you, that was exactly what I needed.
Nick Parker
Not everything that can be counted counts, and not everything that counts can be counted. - Albert Einstein
|
|
|
|
|
hiya is there a way to set a dos prompt to default another drive or directory instead of the c:\
thanks,
grahamoj.
|
|
|
|
|
from run in the start menu:
command /k d:
if you want to default to some directory, you can put it in a batch file.
test.bat:
d:
cd d:\mydir\thisone\
then do:
command /k test.bat
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Aren't they all. Ok, actully I am not sure as to why I am getting this, or even what it really means. I am simply writing a MC++ assembly that does some data access. There error points to this line here:
mySQLConnection = new SqlConnection(S"server=local;Trusted_Connection=yes;database=DeveloperNotes;");
However I have this declared above it:
SqlConnection * mySQLConnection;
I have included the following:
#using <mscorlib.dll>
#using <system.data.dll>
#using <System.Xml.dll>
using namespace System;
using namespace System::Data;
using namespace System::Data::SqlClient;
using namespace System::Xml;
Does anyone have any ideas about this error?
c:\Documents and Settings\User\Desktop\new_article\mcpp\mcpp.cpp(18): error C3624: 'System::ComponentModel::Component': the compiler cannot find this type; it is defined in the assembly 'System'
Nick Parker
May your glass be ever full.
May the roof over your head be always strong.
And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
|
|
|
|
|
Geez, I decided to walk away and came back to my computer 2 hours later, looked at my screen and realized that I was missing this statement:
#using <System.dll>
All Fixed.
Nick Parker
May your glass be ever full.
May the roof over your head be always strong.
And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
|
|
|
|
|
It's because SqlConnection is derived from Component, and the types reside in different assemblies.
Nick
This posting is provided “AS IS” with no warranties, and confers no rights. You assume all risk for your use. © 2002 Microsoft Corporation. All rights reserved.
|
|
|
|
|
Nick,
First off thanks, I don't want to bug you however it doesn't seem like this forum gets as much attention as some of the others. Could you take a look at thread I posted above: http://www.codeproject.com/script/comments/forums.asp?msg=346059&forumid=3785#xx346059xx[^]. I have no idea why I am getting 0 back all the time. This code, once it works will be a class written in MC++ and instantiated in C# as a web service. I hadn't seen anything like it yet so I thought it would be interesting to try. Thanks.
Nick Parker
May your glass be ever full.
May the roof over your head be always strong.
And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing
|
|
|
|
|
Hi,
I have been working with turbo C++ for sometime...But I have not come accross a method to connect a C++ prog to any database. Could anyone help me on this?
Thank you in anticipation.
Sreejit
|
|
|
|
|
ADO, DAO, OLE DB, ODBC. http://msdn.microsoft.com[^]
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
I just created a C++ Managed Web Service and now it's residing on my
'Localhost'. I want to copy it to another web server, but I cannot
find the "Copy Project" option under the "Project" menu. (This option did exist when I was working with ASP.NET applications, but I can't find it when I work with C++ web applications/services)
I also tried creating a Web Deployment project, but I realize that I
cannot run the Windows installer file on the other server because it
belongs to my web host. It is not my own server. After copying the
installer files to that server, I do not know how to remotely execute
it.
How can I work around these problems to deploy my web service on that
server? Thanks.
|
|
|
|
|
Need help with making a C++ program. If anyone is really good with it and can help me out, add me on MSN messenger or yahoo messenger. Thanks
hiloguy@hotmail.com
the_crazy_nemesis@yahoo.com
|
|
|
|
|
What, ANY C++ program ?
#include <iostream>
int main()
{
std::cout << "hello world";
return 0;
}
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Im trying to use a unmanaged C dll from my MC++ dll and one of the
functions requires a char* string into it.
I have tried:
CMethod ( "String" )
CMethod::CMethod( String* name )
{
const wchar_t __pin* pinName = PtrToStringChars( name );
long result = DllMethod ( (char*) pinName );
}
But the result tells me something is wrong!
however if i hardcode the string
long result = DllMethod ( (char*) "String" );
the result is OK!
Im wondering if it has something to do with the ansi/unicode stuff..
Anyone who can help?
|
|
|
|
|
Does anyone kown how I would go about converting an unmnaged c++ project to a managed c++ project.
|
|
|
|
|
i am having a process obgect and i want to get its id in DWORD how to get that process id from csharp project to managed progect code and how to type caste it into DWORD?
r00d0034@yahoo.com
|
|
|
|
|
can i type caste WPARAM and LPARAM into Int32 or not.
is there any lose of values;
<big><small></small></big> Int32 wp=(Int32)wParam;
Int32 lp=(Int32)lParam;
is there any lose of value if i get wParam,lParam like that?
WPARAM wParam=(WPARAM)wp;
LPARAM lParam=(LPARAM)lp;
r00d0034@yahoo.com
|
|
|
|
|
try it. find out.
"[it was..] one of those evenings when you feel that not only will there definitely be a revolution, but that the Association of Manufacturers will foot the bill."
-- Umberto Eco, Foucault's Pendulum
|
|
|
|
|
i chec it but i could not find ?
plz u tell
r00d0034@yahoo.com
|
|
|
|
|
Don't be so stupid.
I really worry when someone is here for so long and continues to post the most basic questions over and over. Are we failing him by answering ? Would he learn if he had to ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|