mssql 
Author Message
 mssql

Hi.
Couldn't you show me how to connect to MS SQL Server from VC++, create
database, and execute some sql-query. I have a good book about SQL Server
but it's not adhered to concrete programming language.
Thanx.


Thu, 16 Jun 2005 00:55:18 GMT  
 mssql

Quote:

>Hi.
>Couldn't you show me how to connect to MS SQL Server from VC++, create
>database, and execute some sql-query. I have a good book about SQL Server
>but it's not adhered to concrete programming language.
>Thanx.

The simplest (although possibly not the best) way is to create an ODBC
link to it and then use the ODBC link in CDatabase an
CRecordset-derived objects.

Paul.
-------------------------------------------
Expressed opinions are usually my own.
Especially if they're any good (of course).
-------------------------------------------
NB Spam trap in e-mail address
-------------------------------------------



Fri, 17 Jun 2005 23:54:00 GMT  
 mssql
  CDatabase db;

  db.Open( "TestServer",    // DSN
                    FALSE,    // Exclusif
                    FALSE,    // Lecture seule
                    "ODBC;",   // ODBC connection
                    TRUE    // cursor lib
                  );

  CODBCRecordset rs( &db );

  rs.Open( "SELECT * FROM tblUsagers WHERE Nom LIKE 'Did%'");

  for( ; ! rs.IsEOF(); rs.MoveNext() ){
                rs.Edit();
                rs.Field("NAME") = "Didz";
                rs.Update();
  }

enjoy



Quote:

> >Hi.
> >Couldn't you show me how to connect to MS SQL Server from VC++, create
> >database, and execute some sql-query. I have a good book about SQL Server
> >but it's not adhered to concrete programming language.
> >Thanx.

> The simplest (although possibly not the best) way is to create an ODBC
> link to it and then use the ODBC link in CDatabase an
> CRecordset-derived objects.

> Paul.
> -------------------------------------------
> Expressed opinions are usually my own.
> Especially if they're any good (of course).
> -------------------------------------------
> NB Spam trap in e-mail address
> -------------------------------------------



Mon, 20 Jun 2005 05:55:26 GMT  
 mssql
88976847
Hi [didz]. You wrote to [] on Wed, 1 Jan 2003 16:55:26 -0500:

Thanx, it works if to use CRecordset instead of CODBCRecordset. What is
CODBCRecordset, i couldn't find it in MSDN?

 d>   CDatabase db;

 d>   db.Open( "TestServer",    // DSN
 d>                     FALSE,    // Exclusif
 d>                     FALSE,    // Lecture seule
 d> "ODBC;",   // ODBC connection
 d>                     TRUE    // cursor lib                   );

 d>   CODBCRecordset rs( &db );

 d>   rs.Open( "SELECT * FROM tblUsagers WHERE Nom LIKE 'Did%'");

 d>   for( ; ! rs.IsEOF(); rs.MoveNext() ){
 d>                 rs.Edit();
 d>                 rs.Field("NAME") = "Didz";
 d>                 rs.Update();
 d>   }

 d> enjoy




 >>> Hi.
 >>> Couldn't you show me how to connect to MS SQL Server from VC++,
 >>> create database, and execute some sql-query. I have a good book
 >>> about SQL Server but it's not adhered to concrete programming
 >>> language.
 >>> Thanx.

 >> The simplest (although possibly not the best) way is to create an
 >> ODBC link to it and then use the ODBC link in CDatabase an
 >> CRecordset-derived objects.

 >> Paul.
 >> -------------------------------------------
 >> Expressed opinions are usually my own.
 >> Especially if they're any good (of course).
 >> -------------------------------------------
 >> NB Spam trap in e-mail address
 >> -------------------------------------------

Bye.
--
"Hello World!" 17 errors, 31 warnings.



Sun, 26 Jun 2005 04:40:25 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. OLE DB Close DB Connection w/MSSQL 6.5

2. Writing MSSQL TEXT field from CRecordset

3. How to insert BLOB data into MSSQL with OLEDB templates library

4. VC++6 skips breakpoints with MSSQL 7.0 sp3

5. dblogin fails when migrating to MSSQL 2000

6. Storing single quote in a MSSQL database using JDBC

7. Oracle vs. MSSQL

8. mssql

9. Saving object OLE into BLOB field in MsSQL

10. OLE DB Close DB Connection w/MSSQL 6.5

11. MSSQL & ADO & threads ???!!

12. VC++ 6.0, MSSQL Server 7.0, ADO >Sample<

 

 
Powered by phpBB® Forum Software