Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
|
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 3rd, 2004, 01:40 PM
Registered User
 
Join Date: Dec 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default DB2 issue with OpenSchema(adSchemaTables)

Hi,

new on this forum I need some help with a DB2 issue

When I use this code:

  Dim Conn As New ADODB.Connection
  Dim TablesSchema As ADODB.Recordset

  Conn.Provider = "MSDASQL"
  Conn.CursorLocation = adUseClient
  Conn.Open "PROVIDER=MSDASQL;dsn=" + sDSN + ";uid=" + USER + ";pwd=" + PASS + ";"
  Set TablesSchema = Conn.OpenSchema(adSchemaTables)

I got an error : "Object or provider is not capable of performing requested operation."

I work with DB2 v8.1 and MDAC 2.8

I don't have this issue if I work on DB2 v7.1

Does somebody knows what's wrong ?

Thanks


 
Old February 2nd, 2005, 02:55 PM
Registered User
 
Join Date: Feb 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Function GetConnection(strDBName As String, Optional strUserName As String = "", Optional strPassword As String = "") As ADODB.Connection

    On Error GoTo GetConnection_ErrHandler

    Dim strConnectionString As String

    strConnectionString = "Provider=IBMDADB2; DSN=" & strDBName
    If strUserName <> "" And strPassword <> "" Then
        strConnectionString = strConnectionString & "; User ID = " & strUserName & "; Password=" & strPassword
    End If

    'a = 2
    'If a = 2 Then
    ' strConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Password=tel589;User ID=strtel;Data Source=DB2ADMIN"
    'Else
    ' strConnectionString = "Provider=IBMDADB2.1;Password=tel589;User ID=strtel;Data Source=DB2ADMIN;Persist Security Info=True"
    ' 'strConnectionString = "Provider=MSDASQL.1;Password=tel589;Persist Security Info=True;User ID=strtel;Data Source=DB2ADMIN;Mode=ReadWrite"
    'End If

    ' Create new ADO connection object
    Dim adoConnection As New ADODB.Connection
    With adoConnection
        .CursorLocation = adUseClient
        .ConnectionString = strConnectionString
    End With

    ' Return new ADO connection object
    Set GetConnection = adoConnection
    Set adoConnection = Nothing
    Exit Function

GetConnection_ErrHandler:
    'MsgBox "Error Code: " & Err.Number & vbNewLine & "Description: " & Err.Description & vbNewLine & "Source: " & Err.Source, vbOKOnly, vbCritical
    Err.Clear
    Set GetConnection = Nothing
End Function






Similar Threads
Thread Thread Starter Forum Replies Last Post
Db2 Biju6 SQL Server 2000 0 September 23rd, 2007 09:53 PM
Date From DB2 gog SQL Server 2000 6 April 30th, 2007 06:13 AM
Trigger in DB2 htyeoh SQL Language 0 March 13th, 2007 09:09 PM
Websphere DB2 vijayakumaroa J2EE 0 November 15th, 2005 01:08 PM
Help w/ DB2 Triggers rrr24 Access 1 September 21st, 2004 01:13 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.