RE: database access from VC++

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Charles

Thank you so much for your suggestions. It did help. Well, I've already
installed .NET framework on my computer and using SQL server 2005 database.
It seems that ADO.net would be the best option. I checked the site
Data Access Using ADO.NET in C++
http://msdn2.microsoft.com/en-us/library/9ctka9db(VS.80).aspx

It shows how to access data (creating/modifying tables) using ADO.net
DataTable object. But my database already exist in SQL server 2005. I need to
access SQL server 2005 database from VC++ interface.

Is there any difference in native and unmanaged code?

Manjree

"Charles Wang[MSFT]" wrote:

Hi Manjree,
I think that anyone of the three ways is OK. This depends on your
requiremnets. If you do not want to install .NET framework, you can use MFC
classes like CDatabase, CRecordset, OLE DB templates like CCommand and ADO.
For ADO.NET, you can interact with your ADO.NET database from native code,
however that requires your compiling your application with /clr switch.

For more information, you may refer to:
Data Access Using ADO.NET in C++
http://msdn2.microsoft.com/en-us/library/9ctka9db(VS.80).aspx

Using the CDatabase class to read an Access databases
http://www.codeproject.com/database/readdb.asp

How to avoid the ODBC login dialog box when using MFC in Visual C++
http://support.microsoft.com/kb/q150552/

Visual C++ ADO Programming
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/
mdhowhowvcusersshouldreadadodocumentation.asp

CCommand Class
http://msdn2.microsoft.com/en-us/library/yfte190h(VS.80).aspx

How to use the Visual C++ ATL Consumer templates to perform a distributed
query
http://support.microsoft.com/kb/198485

If your SQL Server is 2005, I recommend that you use ADO.NET or OLE DB
templates. ADO programming seems a bit more complex than other methods.

Hope this helps. If you have any other questions or concerns, please feel
free to let me know. It is my pleasure to be of assistance.

Best regards,
Charles Wang
Microsoft Online Community Support
=====================================================
Get notification to my posts through email? Please refer to:
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications

If you are using Outlook Express, please make sure you clear the check box
"Tools/Options/Read: Get 300 headers at a time" to see your reply promptly.


Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
======================================================
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
======================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================











.



Relevant Pages

  • RE: Moving from Jet to SQL Everywhere (compact edition)
    ... SQL Server's database's structure is different from that Jet database. ... SQL Server database has much advance database feature that the Jet ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.vc.database)
  • RE: GridView RowEditing Requery question
    ... Gridview is always retrieved from database directly? ... the calling side always get the cached resultset. ... Microsoft MSDN Online Support Lead ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.framework.aspnet.datagridcontrol)
  • Re: GridView RowEditing Requery question
    ... Gridview is always retrieved from database directly? ... ** Implement local cache in your ASP.NET application(for the data access ... Microsoft MSDN Online Support Lead ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.framework.aspnet.datagridcontrol)
  • Re: query-based update failed
    ... Could you please clarify a bit more on what you mean by "checking each record in your recordset to see if it is in your database table at that time"? ... Look forward to your response. ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.sqlserver.odbc)
  • Re: VS2008 DBE (GDR)
    ... target database, which already has data in some lookup tables. ... Microsoft Online Community Support ... nature are best handled working with a dedicated Microsoft Support Engineer ...
    (microsoft.public.vsnet.general)