Connect DB to VB6

Hi,
I'm using VB6 and Oracle Database 10g Express Edition. How can I able to connect the DB to the VB and write programmes?
Edited by: user13489872 on Jun 26, 2011 6:38 AM

Hi,
This might help
http://www.vb6.us/tutorials/oracle-and-visual-basic-using-ado
2 Day Developer Guide
http://download.oracle.com/docs/cd/B25329_01/doc/appdev.102/b25108/xedev_intro.htm#CHDGAJBB
Regards,
Jari

Similar Messages

  • Connection Error in VB6

    Hi,
    I need urgent help on connecting XE database from remote PC via VB6 application, I have install XEClient also on remote PC from where my application running.
    I am able to connect to database thru HOME page of XE as well as from SQLPlus, in local machine also my application is running, bu when i run it from remote pc it gives me an error.
    PLEASE HELP ME !!!.....

    Hi Vishal,
    here is a simple test script to connect to an oracle instance using OLEDB. Save that as "connectToOracleXE.vbs" and run it from the command line (this will give you the usage):
    cscript connectToOracleXE
    Option Explicit
    Dim g_tnsConnectStr, g_uid, g_pwd
    Dim g_objConn
    main()
    Sub main
       If WScript.arguments.count = 0 Then
          showUsage()
       Else
          g_tnsConnectStr      = WScript.arguments(0)
          g_uid                = WScript.arguments(1)
          g_pwd                = WScript.arguments(2)
          WScript.StdOut.WriteLine "g_tnsConnectStr      = " + g_tnsConnectStr
          WScript.StdOut.WriteLine "g_uid      = " + g_uid
          WScript.StdOut.WriteLine "g_pwd      = *****"
          Set g_objConn=nothing
          openDatabaseConnection()
          doSelect()
          closeDatabaseConnection()
       End If
    End Sub
    Sub showUsage
      WScript.StdOut.WriteLine ""
      WScript.StdOut.WriteLine "Usage: cscript connectToOracleXE.vbs <tnsConnectStr> <user> <pwd>"
      WScript.StdOut.WriteLine ""
      WScript.StdOut.WriteLine "Bsp. : cscript connectToOracleXE.vbs xe scott tiger"
      WScript.StdOut.WriteLine ""
    End Sub
    Sub doSelect
       Dim objRS
       Dim objCMD
       Dim i
       Set objCMD = CreateObject("ADODB.Command")
       Set objRS  = CreateObject("ADODB.Recordset")
       objCMD.ActiveConnection = g_objConn
       objCMD.CommandText = "select username from all_users order by username"
       objRS.Open objCMD
       objRS.movefirst
       Do While Not objRS.EOF
            WScript.StdOut.WriteLine "User=" & objRS.Fields(0).Value
            objRS.movenext
       Loop
       'Clean up
       objRS.Close
       set objRS = Nothing
       set objCMD= Nothing
    End Sub
    Sub openDatabaseConnection()
       If g_objConn is nothing Then
          'MsgBox "open connection"
          Set g_objConn = CreateObject("ADODB.Connection")
          g_objConn.Open "Provider=OraOLEDB.Oracle;Data Source=" + g_tnsConnectStr + ";User ID=" + g_uid + ";Password=" + g_pwd
       End If
    End Sub
    Sub closeDatabaseConnection()
       If Not (g_objConn Is Nothing) Then
          'MsgBox "close connection"
          g_objConn.Close
          Set g_objConn = nothing
       End If
    End Sub
    Function NVL(value, ifnull)
        If IsNull(value) Then
            NVL = ifnull
        Else
            NVL = value
        End If
    End FunctionYour problem could be related to security issues. Please try to run it as the local machine administrator.
    http://www.eggheadcafe.com/software/aspnet/31897247/oracleclient-oracle-10g.aspx
    Regards,
    ~Dietmar.

  • Connect 9i from vb6 using ADO

    Hi, im havin troubles connectin vb6 usin ADO to Oracle Client 9i, i can connect using OLE DB provider but with MSDAORA i cant connect, why is that?
    Can anyone drive me in the right direction??
    Thanx

    There are two "generic" function modules to read table data from SAP. The one above and RFC_GET_TABLE_ENTRIES. However, most of the time you want to filter/process the data before it leaves SAP as large data handling is slow in VB. If you have ABAP skills it is often better to develop your own RFC enabled function module.
    As of the VB access, there is several OCX you can use, documentation link:
    http://help.sap.com/saphelp_46c/helpdata/en/39/7e11e0ac6011d189c60000e829fbbd/frameset.htm
    Help title: SAP Automation RFC and BAPI Interfaces (BC-FES-AIT
    It's all fairly straightforward once you get into it.
    PS I almost always use the functions OCX...

  • Problem connection to database when opening Crystal Report in VB6 app

    Hi all, first post, so be gentle!
    I've developed a simple app and database using VB6 and SQL Server 2005 and is seems to be working well when i test it.
    Problem i have is after i installed the app on another PC. When the user tries to open the report they get an error when the report tries to connect to the database. It appears the report is trying to connect to the SQL Server using the user's AD account details, yet i set the report up with a trusted connection. I created a replica ODBC connection (as used by me when designing the report) on the users PC to see if that was what was missing. THis was set up to use the generic SQL Server logon details. Unfortubately the report is still trying to connect with the user's AD details.
    I had a bash at creating the VB commands to set the connection settings, but i couldn't get this to work.
    If anyone can help point me in the right direction or show me the correct code/steps to get th connection details correct, i'd be very grateful.
    Here is the code i have in my app:
    (Form1)
    Dim crxApplication As New CRAXDRT.Application
    Public Report As CRAXDRT.Report
    Private Sub cmdRunReport_Click()
    ReportPath = App.Path & "\" & File1.FileName
    If (File1.FileName = "SKU MTM Report - ADR.rpt" Or File1.FileName = "SKU MTM Report - BS100.rpt") Then
        Set Report = crxApplication.OpenReport(ReportPath, 1)
        Report.ParameterFields.Item(1).AddCurrentValue (Trim(DataCombo1.Text))
        Report.ParameterFields.Item(2).AddCurrentValue (Trim(DataCombo2.Text))
        Report.ParameterFields.Item(3).AddCurrentValue (Trim(DataCombo3.Text))
    End If
    frmreports2.Show
    End Sub
    (Form2 with Crystal ActiveX Viewer component)
    Private Sub Form_Load()
    CrystalActiveXReportViewer1.ReportSource = frmReports.Report
    CrystalActiveXReportViewer1.ViewReport
    End Sub
    Thanks in advance for any advice!
    Edited by: James McCaig on Feb 5, 2009 12:39 PM

    Here is an article on how to distribute the runtime using msm files. I think the articles was written in CR 9, but all applies, save the names of the msm files:
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/901c0761-cf1d-2b10-dea4-8e83937a9337
    Note that you have to use a utility such as Wise, InstallShield, MS Visual Installer, etc., to create your deployment.
    I have also created a short wiki that describes the msm downloads for each version of CR:
    https://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsReportDesignerComponentRuntimeDistribution-Versionspre8.0.xto12.0
    Ludek

  • VB6 source code cannot connect to Oracle database after compile to file.exe

    Hi All,
    I have a problem about VB6 connect with Oracle database. It can connect as normal when run on VB program. After compiled to file.exe and execute, it cannot connect to Oracle database. What's going on ? Please advise? Thank you.
    Here is sample of my code connection.
    Option Explicit
    Private wsData As New ADODB.Connection
    wsData.ConnectionString = _
    "Provider=MSDAORA.1;User ID=lsp;Password=lsp2007;Data Source=prd01;Persist Security Info=False"
    wsData.Open
    End sub
    Rgads,
    Ats.

    Hi,
    I believe you're in the wrong forum, this forum is for Oracle Application Express.

  • Simultaneously Connecting Multiple Tables of the same Database to Textboxes of the same Form using a single ADO Control Code using VB6 Enterprise Edition and MS Access 2007

    Iv 10 Tables consisting of atleast 10 fields each in a single Database. Bt, Im only able to connect 1 table at a time to a form using an ADO Control. Im able to add data from table 'student' to text-boxes in my form. Bt, hw can I add data from field(0) of
    Table 'Student' to Textbox1 and data from field(0) of Table 'Marks' to Textbox2 using VB6??
    This is the current sample coding iv got to connect a single table to a form:
    Global con As New ADODB.Connection
    Global rs As New ADODB.Recordset
    Public Function Connect()
    If con.State = 1 Then con.Close
    con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\bca.mdb;Persist Security Info=False"
    End Function
    Private Sub Add_Click()
    If rs.State = 1 Then rs.Close
    rs.Open "select * from student", con, adOpenDynamic, adLockOptimistic
    rs.AddNew
    rs.Fields(0) = (Text1.Text)
    rs.Fields(1) = (Text2.Text)
    rs.Fields(2) = (Text13.Text)
    rs.Fields(3) = (Text4.Text)
    rs.Fields(4) = (Text5.Text)
    rs.Fields(5) = (Text6.Text)
    rs.Fields(6) = (Text7.Text)
    rs.Fields(7) = (Text8.Text)
    rs.Fields(8) = (Text9.Text)
    rs.Fields(9) = (Text10.Text)
    rs.Fields(10) = (Text11.Text)
    rs.Update
    MsgBox " Record Added"
    End Sub
    What can I do to add fields from 2 different tables to different text boxes within the same form using a single ado control using vb6 and MS Access 2007??

    Hi,
    Since VB6 product is not supported in this forum, you may go to these forums for support:
    #Where to post your VB 6 questions
    http://social.msdn.microsoft.com/Forums/en-US/6a0719fe-14af-47f7-9f51-a8ea2b9c8d6b/where-to-post-your-vb-6-questions
    Thank you for your understanding.
    Best regards,
    Franklin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Connecting to an Azure SQL Database from VB6

    We have an old Application that is accessing a database located on a client site. We currently access this database using ADO and SQL Authentication. Would it be possible to migrate to Azure SQL Server and connect to it from the VB6 Application by just changing
    the connection string?

    Yes, but you have to make sure that you are not using any features that SQL Azure doesn't support. And make sure that the SQL Azure server address is open for connection from outside. You also need to be concerned about data security.
    Frank

  • Connecting to Oracle lite via VB6

    Hello
    is there a better way to connect to Oracle 10g when using VB6?
    this is what I have:
    Under references I am using Microsoft DAO 3.6 Object library
    I do have a module where I defined the following public variables:
    Public wsOracle As DAO.Workspace
    Public cnOracle As DAO.Connection
    Public strConn As String
    and a function to alllow me to connect to the database:
    Function ConnectDB()
    On Error GoTo Error_DataBaseError
    strConn = "ODBC;DSN=MY_DATABASE;UID=user;PWD=passr"
    Set wsOracle = DBEngine.CreateWorkspace("", "admin", "admin", dbUseODBC)
    wsOracle.DefaultCursorDriver = dbUseClientBatchCursor
    Set cnOracle = wsOracle.OpenConnection("", dbDriverNoPrompt, False, strConn)
    Error_DataBaseError:
    If Err <> 0 Then
    Call ErrorCatching("ConnectDB ()")
    End If
    End Function
    It seems to work but I am having issues, two apps are connected to the same Database one is in power builder y the other in VB6 after a certain time of inactivity I get timed out from the VB app and this gets also into the power builder app.
    but if one app is open for a long time it seems to work just fine. any ideas why?
    I read that I can use the Oracle Lite 40 ODBC Driver
    but I can't seem to find a way to do the call from VB6
    any ideas?
    any enlightenment will be appreciated

    Unfortunately, in 2.0 beta, the Infobus Data Form wizard
    connection editor only supported the Oracle Thin, OCI7 and OCI8
    drivers. For 2.0 production, Oracle Lite and the JDBC-ODBC bridge
    will also be supported.
    Regards,
    JDeveloper Team
    Poorna Byri (guest) wrote:
    : Hi,
    : Can we can connect to Oracle Lite 3.5 from Oracle JDeveloper2.0
    : Beta using Infobus Data Form. When I tried to create a file
    based
    : on "Infobus Based Data Form" wizard it is not displaying Oracle
    : Lite 3.5 driver. Can I create a TNS name for Oracle Lite 3.5
    : database.
    : Any help.
    : Thanks.
    : Poorna Byri
    null

  • Running VB6 on Itanium Server to Connect Oracle 10g workaround

    Hello, It might help someother in the future, so I am writting it here. It took our one week to find that walkaround solution.
    Platform:
    Windows 2003 Server Enterprise Itanium + Oracle 10g R2 Itanium Server
    Code written in Visual Basic 6.0 + VC++6.0 (MFC, heavily ATL)
    Database access are done thru OLE DB.
    Problem:
    32 bit applications are not able to connect to Oracle 10g. A vbs test application can connect to 64 bit oracle itanium server, but the same code in vb6 cannot connect to oracle.
    Error message is -> 'Provider cannot be found. It may not be properly installed.'
    We found that means an 32 bit application cannot access to 64 bit oracle data providers for ole db!
    Solution:
    We have installed 32 bit Oracle 8.1.7 client on Itanium server. And We have created TNS definitions within Oracle 8.1.7 oracle\network\admin directory manually (you have to do that by hand) when we run TNSPING <OUR-TNS> it started to work.
    Out vb6 test application started to run correctly after these.
    I hope this will help somebody, since nobody helped us to save time.

    The essbase server name is ts119licalnn, it is shown under essbase servers in EAS.
    By not using the default Essbase node 'EssbaseCluster-1', it has revealed the port number EAS uses to connect to essbase, in this instance, 1443.
    The problem was that I did not have the correct port number, is there an easier way of finding the correct port number?
    Cheers,

  • Problems connecting Client 9i from vb6

    Hi, ive got an app, which connects to Oracle Client 9i from vb6 using ADO, the problem is that in some client machines i can connect with OraOleDB.Oracle.1 Provider (including mine) but in the others just got a sucessfull connection with MSDAORA provider and i dont know why..
    Can anyone help me in order to use just one provider, thanks

    Hello,
    You must set DNS client on windows (or host name in hosts file)
    regards

  • VB6 - Keep Connection open?

    Hi,
    I have developed a VB6 application which logs on / connects to SAP and executes a number of RFC's.
    At the moment I have left the connection open throughout the running of my application, so that several RFC's can be executed without the need to log on / off each time. However, I have discovered that SAP messages being returned to me do not appear to be cleared (from memory) giving me incorrect messages. If the user stops and starts the connection each time before executing an RFC , this does not happen and messages / results are as expected.
    Should I be killing the connection for every RFC I execute, or am I missing some more basic refresh type of command?
    Another question, which may well be answered by the previous one: one of the RFC's I need to execute involves uploading from one line of data to many lines of data. I intend to loop through each line and execute the RFC for each line of data, as this appears to be how the RFC handles it. Given that I may have many lines and therfore many RFC calls, is it best to repeatedly call the RFC without closing the connection, as posted above? If I have to close the connection and re-open it each time as well as call the RFC, it could turn out to be a lengthy process.
    Hope you can advise,
    thanks,
    Steve

    Hi,
    I'm not quite sure I understand your question. If you want to open only a single connection and use only that connection, you'll have to do that in your code.
    What is your DBA complaining about exactly though? Do you accumulate sessions, is that why he/she is concerned? You have idle sessions not being used? How many sessions? etc.
    I'd check to make sure your code is cleaning up properly, and use connection pooling if you're not already.
    Hope it helps,
    greg

  • Can we connect to oracle 9i using vb6.0 in 64 bit machine.

    Can we connect to oracle 9i using vb6.0 in 64 bit machine.
    Code i have written is
    dim conn as new ADODB.Connection
    conn.open("Provider=MSDAORA.1;password=pw;user id=usname;data source=dbname;Persist Security info=false")
    but it is throwing an error saying
    "Connection not open"
    But the same code is working in vb.net.
    Do we need to install any providers for 64 bit machine?

    I have had no luck doing this in the 64-bit ODAC or otherwise. If anybody succeeds I would love to hear about it. My experience follows for those interested:
    I am trying to migrate some working VB6 code from Windows 2000 Server to 64-bit Windows Server 2003 but can't get the OLEDB connection to Oracle to work.
    In the working code (x86 environment), I am using ADO 2.8 and Microsoft OLEDB Provider for Oracle (MSDAORA). Since the Microsoft OLEDB provider for Oracle is no longer supported or available on Windows Server 2003 x64, I tried to use the 32-bit Oracle OLEDB provider in ODAC 10.2 but may have run into the parsing bug posted on MSDN (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=159581). Next, I successfully installed the beta 64-bit version of ODAC 10.2, but when I try to open the connection I receive "Error 3706 Provider cannot be found. It may not be properly installed." However, I can successfully TNSPing the data source.
    Windows Server 2003 x64 (not Itanium)
    Oracle Enterprise 9.2
    Microsoft Visual Basic 6
    Microsoft ADO 2.8 (Objects & Recordset references)
    Oracle OLEDB Provider (ODAC 10.2, 64-bit)
    Code Snippet:
    Set m_dbConn = New ADODB.Connection
    With m_dbConn
    .ConnectionString = "Provider=OraOLEDB.Oracle;Data Source=oplprod; User ID=myid; Password=mypwd;"
    .ConnectionTimeout = 10
    .CursorLocation = adUseClient
    .Open
    End With

  • Crystal reports and vb6.0 and database connectivity

    Hello,
    We have installed crystal report 2008 trial version in our system and after installation we are unable to view the crystal report component ocx crystl32.ocx and add the same into a vb form and create a connectivity between access database.
    Please help on the above query.
    Mobile:+91 9880553553.
    Thanks,
    Ram.

    Hello Ram,
    The OCX (Crystl32.ocx) was retired after CR8.5.  It will not work with CR2008 reports.  Additionally, there are no other COM components that ship with CR2008 to work with VB6.
    With CR2008 you'll have to migrate to use Visual Studios and the Crystal Reports .NET SDK.
    You can search on the Crystal Reports .NET forum for additional information on getting started with VS.NET and Crystal Reports 2008.
    Sincerely,
    Dan Kelleher

  • Connection error with Crystal Report XI, VB6 and Sybase ASE15

    Hello !
    I have an error #4002 when I want to launch a report in VB6 with the ActiveX Crystal Report Viewer.
    I use Sybase ASE 15 with an ODBC link and the reports run stored procedures.
    This error seems to be an authentification error, but I don't know what parameters are missing or wrong...
    - My reports works well in the report designer.
    - The reports connected to a text file or an ADO recordset work in VB6.
    - The Verify Database works in design mode in VB6.
    - The problem is the same with tables, stored procedures, SQL and with or without parameters...
    - I tried to connect the report to a DataEnvironnment but I get the same error.
    The problem appears when I use the Crystal Wizard to create a form automatically AND when I create objects directly in code like :
        Dim crapp As CRAXDRT.Application
        Dim oReport As CRAXDRT.Report
        Set crapp = New CRAXDRT.Application
        Set oReport = crapp.OpenReport("C:\myreport.rpt")
        CRViewer.ReportSource = oReport
        CRViewer.viewReport
    Please help !

    Hello,
    I don't see any database logon code in what you posted.  You need to log onto the database at runtime since Crystal Reports will never store passwords.
    You can download and review the [Connection Properties|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/00635998-751e-2b10-9cba-f50ee1e4ef81] document for more information on how to log onto your database at runtime.  This document was written for CR9, but it's the same for CR10, CR XI (v11.0), and CR XI R2 (v11.5).
    I hope this helps.
    Sincerely,
    Dan Kelleher

  • How to connect SQL SHAPED Child RecordSet to A VB6 Embeded Sub Report?

    Please Help me in connect SQL SHAPED Child RecordSet to A VB6 Embeded Sub Report.
    Here is the Code I am currently Using in VB6 SP6.
    I want to Connect to "Command1" Child Recordset with "item" Sub Report.Please Help Me.
    Option Explicit
    ' The ADO connection to the local database.
    Public oConn As ADODB.Connection
    Public ocmd1 As ADODB.Command
    Public ocmd2 As ADODB.Command
    Public ocmd3 As ADODB.Command
    Dim rs As ADODB.Recordset
    Dim rs_sb1 As ADODB.Recordset
    Dim rs_sb2 As ADODB.Recordset
    Public invoice_report As New CrystalReport1
    Public itemsub_report As Report
    Public servicesub_report As Report
    Public sConnectString As String
    Public strSQL As String
    Dim ADOrs As ADODB.Recordset
    Private Sub Form_Load()
    minvno = 3
    'msubtype_id = 16
    'Create ADO Connection object
    Set oConn = New ADODB.Connection
    sConnectString = "Provider = MSDataShape;Data Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & App.Path & "\stocks\business.mdb;" & "Persist Security Info=False;" & "User ID=Admin;" & "Jet OLEDB:Database Password=apple14;"
    oConn.Open sConnectString
    'Create ADO Command object
    Set ocmd1 = New ADODB.Command
    Set ocmd1.ActiveConnection = oConn
    ocmd1.CommandText = " SHAPE {SELECT invoices_customer., contacts., invoice_subtypes.* FROM invoices_customer, contacts, invoice_subtypes WHERE invoices_customer.contact_id = contacts.contact_id AND invoices_customer.subtype_id = invoice_subtypes.subtype_id AND invoices_customer.inv_no = " & minvno & " AND invoices_customer.type = 'service'} AS invoice_customer APPEND ({SELECT * FROM `item_customer`} AS Command1 RELATE 'inv_no' TO 'inv_no','invoices_customer.subtype_id' TO 'subtype_id') AS Command1,({SELECT * FROM `service_customer`} AS Command2 RELATE 'inv_no' TO 'inv_no','invoices_customer.subtype_id' TO 'subtype_id') AS Command2"
    ocmd1.CommandType = adCmdText
    Set rs = New ADODB.Recordset ' Recordset for the main report
    Set rs = ocmd1.Execute
    Dim crs As ADODB.Recordset
    Set crs = rs.Fields("Command1").Value
    'Set crs = rs!command1.Value
    Me.Caption = crs.RecordCount
    ' Add the datasource to the report
    invoice_report.Database.AddADOCommand oConn, ocmd1
    ' Connect the recordset to the main report
    invoice_report.DiscardSavedData
    invoice_report.Database.SetDataSource rs, 3, 1
    invoice_report.AutoSetUnboundFieldSource crBMTName
    If rs.RecordCount > 0 Then
    With invoice_report
    .Field1.SetUnboundFieldSource ("{ADO.date}")
    If rs("post") = "None" Then
    .Field2.SetUnboundFieldSource ""
    Else
    .Field2.SetUnboundFieldSource ("{ADO.post}")
    End If
    .Field4.SetUnboundFieldSource ("{ADO.name}")
    .Field5.SetUnboundFieldSource ("{ADO.address}")
    .Field6.SetUnboundFieldSource ("{ADO.mpay}")
    If rs("mpay") = "Cash" Then
    .Text2.SetText ""
    Else
    If rs("mpay") = "Cheque" Then
    .Text2.SetText "Cheq.Date"
    .Field7.SetUnboundFieldSource ("{ADO.cheque}")
    .Field8.SetUnboundFieldSource ("{ADO.bank}")
    .Field9.SetUnboundFieldSource ("{ADO.cheque_date}")
    Else
    If rs("mpay") = "Credit Card" Then
    .Text2.SetText "Exp.Date"
    .Field7.SetUnboundFieldSource ("{ADO.ccard}")
    .Field8.SetUnboundFieldSource ("{ADO.bank}")
    .Field11.SetUnboundFieldSource ("{ADO.cctype}")
    .Field9.SetUnboundFieldSource ("{ADO.exp_date}")
    Else
    End If
    End If
    End If
    .Field10.SetUnboundFieldSource ("{ADO.vno}")
    End With
    Else
    End If
    invoice_report.Subreport1.OpenSubreport.Database.AddADOCommand oConn, ocmd1
    'Set itemsub_report = invoice_report.Subreport1.OpenSubreport
    Set itemsub_report = invoice_report.OpenSubreport("item")
    ' connect the other recordset to the sub-report
    itemsub_report.DiscardSavedData
    itemsub_report.Database.SetDataSource rs, 3, 1
    itemsub_report.AutoSetUnboundFieldSource crBMTName
    If rs.RecordCount > 0 Then
    With itemsub_report
    '.Text1.SetText "Invoice - " & rs("subtype")
    .Text1.SetText "Invoice - " & itemsub_report.Database.Tables(1).Fields(41).Name
    .Field2.SetUnboundFieldSource itemsub_report.Database.Tables(1).Fields(41).Name
    ' .Field1.SetUnboundFieldSource ("{ADO.Command1-qty}")
    '.Field2.SetUnboundFieldSource ("{ADO.Command1-brand}")
    .Field3.SetUnboundFieldSource ("{ADO.Command1-brand_id}")
    .Field4.SetUnboundFieldSource ("{ADO.Command1-category}")
    .Field5.SetUnboundFieldSource ("{ADO.Command1-price}")
    .Field6.SetUnboundFieldSource ("{ADO.Command1-value}")
    .Field7.SetUnboundFieldSource ("{ADO.job_no}")
    End With
    invoice_report.Field12.SetUnboundFieldSource ("{ADO.item_charge}")
    Else
    End If
    invoice_report.Subreport2.OpenSubreport.Database.AddADOCommand oConn, ocmd1
    Set servicesub_report = invoice_report.Subreport2.OpenSubreport
    ' connect the other recordset to the sub-report
    servicesub_report.DiscardSavedData
    servicesub_report.Database.SetDataSource rs, 3, 1
    servicesub_report.AutoSetUnboundFieldSource crBMTName
    If rs.RecordCount > 0 Then
    With servicesub_report
    .Text1.SetText "Service Charges"
    .Field1.SetUnboundFieldSource ("{ADO.Command2-desc}")
    .Field2.SetUnboundFieldSource ("{ADO.Command2-service_charge}")
    .Field3.SetUnboundFieldSource ("{ADO.Command2-total_scharge}")
    End With
    invoice_report.Field12.SetUnboundFieldSource ("{ADO.item_charge}")
    Else
    End If
    invoice_report.Text3.SetText "Total Bill Value ="
    invoice_report.Field13.SetUnboundFieldSource ("{ADO.bill_value}")
    CRViewer1.ReportSource = invoice_report
    CRViewer1.ViewReport
    End Sub

    Hi lalantha,
    It looks like you are using the RDC as your report engine. The RDC has been deprecated since version 9 meaning there has been no new funcitonalty added to it. There is no option in the RDC to set location to a Command object, it was added to RAS in Cr Xi R2 ( 11.5 ).
    Only work around is to make a connection to the Database directly or using a disconnect record set, there may be other ways but it will require you to rebuild your report. We don't have the ability to map a report that used a COmmand object to another data source.
    Thank you
    Don

Maybe you are looking for