473,408 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Hello! Hello! Is anybody there! I really could use some help on 2 line so code? How about it.

Dear Associaties:

I asked this question last Friday, and here it is Wednesday and NOBODY has replied. Come on. Help a little. All that I am looking for is 2 lines of code. One of you must know how to do this. Please respond.

I'm trying to get the DataLink to work under C++, and I need help. I'm able to make it work under VB and C#, but not C++. Under C# (with references to "adodb", and "MSDASC") , I would accomplish this by the following code:

ADODB._Connection cn; //Define ADO Connection.

MSDASC.DataLinks dataLink = new MSDASC.DataLinks():
cn = (ADODB._Connection) dataLink.PromptNew();

Under C++, I would expect some like this:

#using <adodb.dll> //Both using had to be "Resolve #using References" under the Property Pages C/C++.
#using <Interop.MSDASC.dll> //... because MSDASC alone fails, even though I resolved under the Property Pages.

ADODB::Connection* cn; //This line compiles OK, so long as the resolves have been done.

MSDASC::DataLinks* dataLink = new MSDASC::DataLinks(); //FAILS:Error C2061:Syntax error: identifier DataLinks
cn = (ADODB::Connection) dataLink->PromptNew() //Can't get this far because the previous line fails. I'm just guessing at this point.

I go to MSDN, and there is no definition for Error C2061, so I am faces with a mystery. I realize that this is Unmanage code, but certain there must be a way to call up the DataLink from .Net C++. Would someone please advise how I can get around this problem.

Sincerely,

Burton G. Wilkins, Programmer.

P.S: The libraries I am using are these:
MSDASC = c:\Program Files\Word\Samples\C++\AccessMaintenance\Debug\Int erop.MSDASC.dll Microsoft OLE DB Service Component 1.0 Type Library
ADODB = C:\Program Files\Microsoft.NET\Primary Interop Assemblies\adodb.dll
Nov 16 '05 #1
1 2010
Burton Wilkins wrote:
I'm trying to get the DataLink to work under C++, and I need help. I'm
able to make it work under VB and C#, but not C++. Under C# (with
references to "adodb", and "MSDASC") , I would accomplish this by the
following code:

[SNIP]
Hi Burton, I was able to get the following code to compile:

#using <mscorlib.dll>
#using <adodb.dll>
#using <MSDASC.dll>

int main() {
ADODB::Connection* cn;

MSDASC::DataLinks* dataLink = new MSDASC::DataLinksClass();
cn = __try_cast<ADODB::Connection*>(dataLink->PromptNew());
}

The problem was likely with "DataLinks" vs. "DataLinksClass". The assembly
tlbimp generates creates the interfaces with the natural name and the
classes with the name and "Class" as a suffix. I often find the ildasm tool
invaluable in these cases. Just type "ildasm <assemblyname>" to get a look
at the internals of the tool.
//FAILS:Error C2061:Syntax error: identifier DataLinks
I go to MSDN, and there is no definition for Error C2061, so I am faces with a mystery.
I'm not sure why you didn't find C2061 on MSDN. Basically, the compiler
didn't understand the identifier DataLinks. I was not able to get the same
error message -- I tried two different versions of the C++ compiler. The
VC7.1 compiler gave a helpful diagnostic that should have led to the
solution I described above.
I realize that this is Unmanage code, but certain there must be a way to
call up the DataLink from .Net C++. Would someone please advise how I can get around this problem.


Hopefully, this will help you get past where you're stuck. Good luck.

Cheerio!

--
Brandon Bray Visual C++ Compiler
This posting is provided AS IS with no warranties, and confers no rights.
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Ali | last post by:
Please anyone I would really like the code for makinga dome in vpython. I would like to be able to adjust he color, axis, radius, and pos.
1
by: Phil Galey | last post by:
I'm developing in VB.NET 2002 on Windows 2000 SP4. When I'm running my application in the design environment, it generates an error at one point that says: "There is no source code available for...
0
by: Delf | last post by:
Hi all, I'm working on a solution which contains WebServices (C#), C# libraries and some unmanaged DLLs (C++). Here the layout of the calls : WebService (C#) <-> C# DLL <-> unmanaged DLL ...
5
by: aaj | last post by:
Hi all I have written a small app on my machine that I have passed on to a colleague for testing. The problem is, as soon as he steps through in debug mode and reaches try { conn.Open();...
2
by: PC User | last post by:
I found some VB code to printout a richtext field and I'm trying to adapt it to MS Access 2000. I think there might be some small changes to make the adaption between VB versions. Also my OS is...
6
by: Mark | last post by:
Hi All, Access 2002 using Windows XP I am pretty new to writing code so please bear with me. I have some code which exectues an append and a select query. Both queries require the user to...
1
by: Randy | last post by:
Hello All, I've got an app which performs a simple query to a web service and stores the returning data in a DataSet. The first time through it works find and as expected. The problem is that the...
1
by: rahullko05 | last post by:
Can anybody help me? to write one line code to render html inside a div element. Thanks.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.