On Apr 7, 12:48 pm, Erland Sommarskog <esq...@sommarskog.se> wrote:
> RosH (roshin.maj...@gmail.com) writes:
> > I was able to build the following code with the help of some help
> > topics from Microsoft site for Outlook programming. But unfortunately
> > errors keep on following me. I have included the code and the error
> > below. I would appreciate you to comment on it.
> >...
> > Error-----------------
> > Multiple-Step OLE DB operation generated errors. Check each OLE DB
> > status value, if available. No work was done.
>
> > Code----------------------
>
> > Sub RosHConnectSQL()
> > Dim Dbcon As New ADODB.Connection
> > Dim Dbcom As New ADODB.Command
> > Dim DbRs As New ADODB.Recordset
>
> > Dbcon.ConnectionString = "Data Source=.
> > \SQLEXPRESS;AttachDbFilename=""C:\Documents and Settings\Administrator
> > \My Documents\Website.mdf"";Integrated Security=True;Connect
> > Timeout=30;User Instance=True"
>
> I am puzzled. The error message is a very generic OLE DB error message,
> but as I recall it mainly appears when you run queries, and not when you
> connect.
>
> In any case, there is an error in your connection string: the
> property User Instance is only supported with ADO .Net, and not with
> native code, such as ADO Classic. It might be that ADO and OLE DB just
> ignores this property, but try removing it and see if things work
> out better. I would also recommend that you specify the database with
> the Database property, rather than AttachDbFileName.
>
> --
> Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se
>
> Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books... > Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx