Advertisement

12.28.2006 at 03:41PM PST, ID: 22105655
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.6

compile error when following VC.NET tutorial...

Asked by RamboIII in Microsoft Visual C++.Net

Tags: , ,

Hello.
When I try to follow the instructions in this tutorial:
http://www.functionx.com/mysqlnet/vcnet/Lesson04.htm
I allways get these errors:
*****************************************
AssemblyInfo.cpp
sqltest1.cpp
Form1.h(90) : error C3921: Use of S-prefixed strings requires /clr:oldSyntax command line option
        When compiling with /clr, an implicit conversion exists from string literal type to System::String^. If necessary to avoid ambiguity, cast to System::String^
Form1.h(91) : error C3921: Use of S-prefixed strings requires /clr:oldSyntax command line option
        When compiling with /clr, an implicit conversion exists from string literal type to System::String^. If necessary to avoid ambiguity, cast to System::String^
Form1.h(90) : error C3699: '*' : cannot use this indirection on type 'MySql::Data::MySqlClient::MySqlConnection'
        compiler replacing '*' with '^' to continue parsing
Form1.h(90) : error C2750: 'MySql::Data::MySqlClient::MySqlConnection' : cannot use 'new' on the reference type; use 'gcnew' instead
Form1.h(90) : error C2440: 'initializing' : cannot convert from 'MySql::Data::MySqlClient::MySqlConnection *' to 'MySql::Data::MySqlClient::MySqlConnection ^'
        No user-defined-conversion operator available, or
        Cannot convert an unmanaged type to a managed type
Form1.h(91) : error C3699: '*' : cannot use this indirection on type 'MySql::Data::MySqlClient::MySqlCommand'
        compiler replacing '*' with '^' to continue parsing
Form1.h(91) : error C2750: 'MySql::Data::MySqlClient::MySqlCommand' : cannot use 'new' on the reference type; use 'gcnew' instead
Form1.h(91) : error C2440: 'initializing' : cannot convert from 'MySql::Data::MySqlClient::MySqlCommand *' to 'MySql::Data::MySqlClient::MySqlCommand ^'

******************************
where line 90 is the first one of this sequence:
MySqlConnection *conDatabase = new MySqlConnection(S"Data Source=localhost;Persist Security Info=yes");
MySqlCommand    *cmdDatabase = new MySqlCommand(S"CREATE DATABASE CarRental1;", conDatabase);

       conDatabase->Open();

       cmdDatabase->ExecuteNonQuery();
       conDatabase->Close();

So:
My questions:
I changed this to:

MySqlConnection ^conDatabase = gcnew MySqlConnection(L"Data Source=localhost;Persist Security Info=yes");
MySqlCommand    ^cmdDatabase = gcnew MySqlCommand(L"CREATE DATABASE CarRental1;", conDatabase);

       conDatabase->Open();

       cmdDatabase->ExecuteNonQuery();
       conDatabase->Close();

but just because the compiler told me to do so.
Is this OK ? (never worked with gcnew, and no experience with unicode)...

Thanks.Start Free Trial
[+][-]12.28.2006 at 11:02PM PST, ID: 18213142

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Visual C++.Net
Tags: use, error, cannot
Sign Up Now!
Solution Provided By: AlexFM
Participating Experts: 1
Solution Grade: A
 
 
[+][-]12.29.2006 at 08:34AM PST, ID: 18214845

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080924-EE-VQP-38