Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the _ ConnectionPtr interface in ADO.NET

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly shows you "how to use the _ ConnectionPtr interface in ADO.NET". The content is easy to understand and clear. I hope it can help you solve your doubts. Let the editor lead you to study and learn the article "how to use the _ ConnectionPtr interface in ADO.NET".

There is still a lot of research on the three interfaces of ADO.NET. Here is a personal explanation on the ADO.NET _ ConnectionPtr interface. The _ ConnectionPtr interface returns a recordset or a null pointer. It is not a good use to return a recordset using the ADO.NET _ ConnectionPtr interface. The operation to return the record is usually implemented with _ RecordserPtr. In order to get the number of records, you have to traverse all records with the _ ConnectionPtr operation, but not with _ RecordserPtr. Use the ADO.NET _ ConnectionPtr interface. _ ConnectionPtr is mainly a connection interface to obtain a connection to the database. Its connection string can be written directly or it can point to an ODBC DSN.

_ ConnectionPtr pConn; if (FAILED (pConn.CreateInstance ("ADODB.Connection")) {AfxMessageBox ("CreateInstance failed!"); return;} CString strSRC; strSRC= "Driver=SQL Server;Server="; strSRC+= "suppersoft"; strSRC+= "; Database="; strSRC+= "mydb"; strSRC+= "; UID=SA;PWD="; CString strSQL = "Insert into student (no,name,sex,address) values _ variant_t varSQL (strSQL); _ bstr_t bstrSRC (strSRC); if (FAILED (pConn- > Open (bstrSRC, ",",-1)) {AfxMessageBox ("Can not open Database!"); pConn.Release (); return;} COleVariant vtOptional ((long) DISP_E_PARAMNOTFOUND,VT_ERROR); pConn- > Execute (_ bstr_t (strSQL), & vtOptional,-1); pConn.Release (); AfxMessageBox ("ok!") The above is all the contents of the article "how to use the _ ConnectionPtr interface in ADO.NET". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report