Re: PLEASE HELP !!!
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Mon, 5 Dec 2005 22:05:55 +0000 (UTC)
jimmyglo (jimmyglo@xxxxxxxxxxxxxxxxxxxxxxxxx) writes:
> now i found one code almost the same as the one i posted here, from those
> examples that you recommended me and here it is :
Almost the same? Yes, but these samples have error-checking!
> ok, now i know why it won't work, it's because #include <iostream.h> .
> But in visual studio 2005 professional i can't use this one, so instead
> i wrote #include<iostream> but then i get that same error.
>
> I found on internet this old iostream.h and copied it, then it looked for
> _defs.h, which i also found and then mem.h...
>
> so with all these files i got like 200 errors, and i think there should be
> some other way to solve it , but i don't know how... :(
The samples were written for the C++ compiler that came with Visual Studio
6, and there are quite some differences between that compiler and the
current one.
I'm an SQL guy, and C++ leaves me quite much in a maze. Visual Studio even
more. (I stick to VS 6 as long as I can.) But I found that I has some
derived from the samples that compiles with VS 2005. The header files are:
#define UNICODE
#define DBINITCONSTANTS
#define INITGUID
#include <assert.h>
#include <windows.h>
#include <stdio.h>
#include <stddef.h>
#include <IOSTREAM>
#include <cguid.h>
#include <oledb.h>
#include <oledberr.h>
#inculde <sqloledb.h>
And this is all from the standard VS .Net thing.
> i was checkin these examples that you gave me, and they all don't on SQL
> server 2005,
The samples are for SQL 2000, that's correct. They will run with SQL 2005
as well. Of course, to use all features for SQL 2005, you should use
SQL Native Client (SQLNCLI) instead, but since you were into MSDASQL
before that SQLOLEDB is still an improvment. (And there is a fine detail
in the samples that does not work with SQLNCLI: the name ReturnVal must
be @ReturnVal.)
> and concerning this connection error that you said, i was
> wondering, in VS 2005 professional, i noticed that when i'm making a new
> VC++ project, there's one tepmlate for SQL server project, and when i
> choose that, it automatically finds my SQL 2005 server, and connects
> after i choose to which database.. So can i use this instead of writing in
> source code connection strings and stuff like that, and is it possible to
> edit then my program from up, since conection is established, so can i
> somehow skip that part in source code and continue...?
If you want to use anything that Visual Studio generates for you, you
are definitely out in the wilderness on your own, with no one to ask
for help. At least you cannot ask me for help. And with the OLE DB
API, there is really much reason to play with connection strings at
all. Just use set the initialization and authorisation properties you
need. You need to use them to set the connection string anyway, and it's
easier to set individual properties.
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.
- References:
- PLEASE HELP !!!
- From: jimmyglo
- Re: PLEASE HELP !!!
- From: Erland Sommarskog
- Re: PLEASE HELP !!!
- From: jimmyglo
- PLEASE HELP !!!
- Prev by Date: Re: PLEASE HELP !!!
- Next by Date: Re: Microsoft OLE DB Provider for ORACLE
- Previous by thread: Re: PLEASE HELP !!!
- Next by thread: Re: PLEASE HELP !!!
- Index(es):
Relevant Pages
|