Re: PLEASE HELP !!!

Tech-Archive recommends: Fix windows errors by optimizing your registry



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
.



Relevant Pages

  • Re: TQL Debugger im SQL Server 2005
    ... >>> Ich habe den SQL Server 2005 Developer Edition mit SQL Server ... >>> Database Services, Analysis Services, Integration Services und ... Ich habe ebenfalls Visual Studio 2005 ...
    (microsoft.public.de.sqlserver)
  • Re: Access 2007->SQL Server2005 "connection was forcibly closed",G
    ... I moved every table I was able to move to the SQL ... closed connections - but all of these errors are in the version which used ... the SQL Server 2000 and everything worked ... communication between ODBC (OLEDB and Native Client, ...
    (microsoft.public.sqlserver.connect)
  • Re: Unable to Apply SP4 to SQL 2000 Cluster (new Node)
    ... Rebuild the node in the failover cluster. ... Scenario 1" in SQL Server 2000 Books Online. ... This setup process updates to SP4 only the binaries on the new ...
    (microsoft.public.sqlserver.clustering)
  • Re: WSS 3.0 question
    ... I followed the advise given in removing WSS 3.0 etc, ... the server is complaining that the SQL service(?) was tempered with or corrupt. ... I may just instal the SQL server as I was going eventuall use it anyway. ... If WSUS 3.0 is installed, I would suggest you uninstall it and then you install WSS 3.0. ...
    (microsoft.public.windows.server.sbs)
  • Re: WSUS
    ... I'm not seeing performance issues with the full enchilada installed, and 25 users busy hitting SQL. ... WSUS isn't difficult to uninstall - if you have WSUS v2 (installed with SBS R2) uninstall R2 from add/remove programs. ... How can anyone work with 4 instances of SQL Server on the same box? ...
    (microsoft.public.windows.server.sbs)