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
Similar Messages
-
Hi
I want to know how to connect SQL server using DNSless connection ?
/* 2003/02/06 eric.leung
* Source : HOME
import java.sql.*;
import java.lang.*;
public class ejdbcsel {
public static void main(String args[]) {
// eric_jsp is ODBC User DNS
// String url = "jdbc:odbc:eric_jsp";
// Using DSNless connection
String url = "";
url = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)}" +
";SERVER=127.0.0.1;DBQ=c:\\example\\ERIC_JSP.mdb";
Connection con;
String query;
query = "select * from pt_mstr";
Statement stmt;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (ClassNotFoundException e) {
System.err.print("ClassNotFoundException " );
System.err.println(e.getMessage());
try {
con = DriverManager.getConnection (url,"","");
stmt = con.createStatement();
ResultSet rec = stmt.executeQuery(query);
// Scan the Database
while(rec.next()) {
System.out.println(rec.getString("pt_part") + "\t"
+ rec.getString("pt_desc"));
stmt.close();
con.close();
} catch (SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
catch (Exception e) {
System.err.println("Error: " + e.toString() + " " + e.getMessage());Use a driver...
http://java.sun.com/products/jdbc/driverdesc.html
http://industry.java.sun.com/products/jdbc/drivers -
How to connect sql server 2008 r2 sp2 with vs2013 ultimate?
how to connect sql server 2008 r2 sp2 with visual studio 2013 ultimate?
Hi Shahzad,
>>how to connect sql server 2008 r2 sp2 with visual studio 2013 ultimate?
Based on your issue, if you wan to connect the sql server 2008 r2 sp2 from VS2013 IDE. I suggest you can try the Ammar and darnold924's suggestion to check your issue.
In addition, I suggest you can also refer the following steps to connect the sql server 2008 r2 sp2 with visual studio 2013 ultimate.
Step1: I suggest you can go to VIEW->SQL Server Object Explorer->Right click SQL Server->Add SQL Server.
Step2: After you connect the SQL Server 2008 r2 sp2 fine, I suggest you can go to VIEW->Server Explorer-> right click the Data Connection->Add Connection.
And then you can create the connect string in the Add Connection dialog box.
Hope it help you!
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. -
How to connect Sql Server 2000 using JDBC ODBC Driver
How to connect Sql Server 2000 using JDBC ODBC Driver ?
plz Send Syntax.
thanksIn SQL Server 2000 the driver class is com.microsoft.jdbc.sqlserver.SQLServerDriver
The connection URL for the default SQL Server 2000 database is jdbc:sqlserver://localhost:1433
Class.forName(
"com.microsoft.sqlserver.jdbc.
SQLServerDriver");
String url =
"jdbc:sqlserver://localhost:1433";
Connection conn = DriverManager.
getConnection(
url, "sa", "sqlserver"); -
How to Connect SQL Server enterprises Manager Version 8.0 with Form 6i
Dear experts
I want to know that How can I connect SQL server Enterprise Manager Version 8.0 with Forms/reprots 6i.
currently I have oracle 9i database at server windows 2003 and I also connected with client (my PC) I work on server.
I also have SQL server in that server 2003 machine and this SQL Server also work with other clients that have VB program.
I want to know that can I connect with this SQL server with Form 6i?You can't. The closest thing would be to create links in an oracle database to the SQL Server database using Heteregeneous Services and connect forms to the that.
This forum is for the SQLDeveloper tool. You will get more complete answers in the "Database General", or "Heterogeneous Services" forums -
How to connect sql server using oracle Client
Hi,
I am working in oracle9i and windows os 32 bit.
I need to connect SQL server 2000 from my oracle client..
I heard about heterogeneous connectivity ...
Please expalin me the steps what to add and how to connect the sql server...
Regs....Are you trying to connect to SQL Server from your Oracle database (i.e. create a database link in Oracle to SQL Server)? Or are you trying to connect to SQL Server using your Oracle client software (i.e. SQL*Plus)?
The former just requires Heterogeneous Services with Generic Connectivity. The latter is functionality that has been depricated and probably no longer works in your environment.
Justin -
How to connect sql developer OE schema and Hr schema,
Hi ,
I downloaded Oracle 10g express edition and SQL developer downloaded in my computer, I don't know how to connect to OE and HR schema, by default the SQL developer and Oracle 10g has only sytem and sys database. And as well I wanted to migrate datas from third party datas , could anyone please , pllease guide me. I am new to this field and just started to learn. what is listener and how to activate Listener and Repositary
Please guide me.
Thanks in advance
ChanThe HR schema installs fine in XE, but the OE schema doesn't quite. I've done it, but there will be errors. The reason is that the OE schema uses some features of XML DB that are not supported in XE. If you want to use the OE schema in XE and you don't mind if it isn't a complete OE schema, then you can get the installation scripts from an Oracle SE or EE installation.
You can also get it from the companion disk for Oracle SE or EE, but this is a bit challenging, because you can't get it by running OUI unless you first install Oracle SE or EE. You need to run an archive utility like WinZip or 7-Zip and look for the scripts inside a compressed file - I forget which one, but I'll look it up if you like. Oh, and since the OE schema isn't really supposed to be installed on XE, Oracle does not support any of the methods for putting it there. -
How to connect sql database with Flash
Dear Friends,
Iam working on a quessinarie (assesment) for elearning software. i want to connect sql database with flash and save my records in back end like add, delete, modification of student result and details.
Kindly help me to connect the sql database. or dot net server. I know how to connect PHP and mysql. But my client dont want php. only sql database and do the add, del, modificaiton.
Thanks in advance,
Syed Abdul Rahimunfortunately no, i do not know ASP well enough to give any code advice, other than the basic concept: make a request on a server-side script (such as ASP) via URLLoader - the script receives variable values (if required), runs the DB queries you wish to invoke, and 'returns' the results - pick them up in the URLVariables class via the event handler in Flash and assign them to local properties if needed, etc.
there are quite a few threads that you could find more specific information on the ASP side, here and elsewhere around the net. -
How to connect sql server to OATS
Hi,
Please guide me how to connect microsoft sql server 2005 to OATS.
I need it urgently.
Please help me.
Thanks,
JatinYou get XE by default but a limited use (ATS only) license for Oracle 11g is included. So you can install and use 11g for ATS.
For testing DBs now a DB Testing module is offered with ATS 9.2. It offers direct DB testing without writing huge amounts of Java code.
/J -
How to connect sql server at RunTime?
Hi,I have a question that when i want to use DBAdapter to connect sql server 2000 in oracle esb at RunTime.
At design Time ,it can work.but at RunTime ,it does't work.
At run time,
1)modify Oracle_Home/j2ee/home/config/application.xml
add follow elements,the path is right:
<library path="../applib/msbase.jar"/>
<library path="../applib/mssqlserver.jar"/>
<library path="../applib/msutil.jar"/>
2)Drop the JAR files into the following directories:
Oracle_Home/j2ee/home/applib
JAR files Include msbase.jar,mssqlserver.jar,msutil.jar
But it does't work!!!
Then i use DataDirect driver:
YMbase.jar,YMutil.jar,YMsqlserver.jar
it does't work either!!!
what should i do ??
Help.
when i use DataDirect driver ,Exception like this:
An unhandled exception has been thrown in the ESB system. The exception reported
is: "org.collaxa.thirdparty.apache.wsif.WSIFException:
esb:///ESB_Projects/PocApp_POCproject/MESInsert.wsdl [
MESInsert_ptt::insert(MtlMesCollection) ] - WSIF JCA Execute of operation
'insert' failed due to: Could not create/access the TopLink Session. This
session is used to connect to the datastore. ; nested exception is: ORABPEL-
11622 Could not create/access the TopLink Session. This session is used to
connect to the datastore. See root exception for the specific exception. You may
need to configure the connection settings in the deployment descriptor (i.e.
$J2EE_HOME/application-deployments/default/DbAdapter/oc4j-ra.xml) and restart
the server. Caused by Exception [TOPLINK-4003] (Oracle TopLink - 10g Release 3
(10.1.3.1.0) (Build 061004)): oracle.toplink.exceptions.DatabaseException
Exception Description: Configuration error. Class
[com.oracle.ias.jdbc.sqlserver.SQLServerDriver] not found.. at
oracle.tip.adapter.fw.wsif.jca.WSIFOperation_JCA.executeRequestResponseOperation
(WSIFOperation_JCA.java:623) at
oracle.tip.adapter.fw.wsif.jca.WSIFOperation_JCA.executeInputOnlyOperation(WSIFO
peration_JCA.java:726) at
oracle.tip.esb.server.common.wsif.WSIFInvoker.executeOperation(Unknown Source)
at oracle.tip.esb.server.common.wsif.WSIFInvoker.nextService(Unknown Source) at
oracle.tip.esb.server.common.wsif.WSIFInvoker.nextService(Unknown Source) at
oracle.tip.esb.server.service.impl.outadapter.OutboundAdapterService.nextService
(Unknown Source) at
oracle.tip.esb.server.service.impl.outadapter.OutboundAdapterService.processBusi
nessEvent(Unknown Source) at
oracle.tip.esb.server.dispatch.InitialEventDispatcher.dispatchNonRoutingService(
Unknown Source) at
oracle.tip.esb.server.dispatch.InitialEventDispatcher.dispatch(Unknown Source)
at oracle.tip.esb.server.dispatch.BusinessEvent.raise(Unknown Source) at
oracle.tip.esb.utils.EventUtils.raiseBusinessEvent(Unknown Source) at oracle.
when i use SQL SERVER JDBC DRIVER,Exception just like before,the different only is
Class [com.microsoft.jdbc.sqlserver.SQLServerDriver] not found ....Hi,
Were you able to configure these 3 jars file. If so can you share the process that we need to follow to configure the environment so that i can access SQLServer.
Thanks,
Amby. -
How to connect SQl Server 2008 to SAP BW
Hi Experts,
i would to build the following scenario.
I would like to connect an infoprovider or a query in sap BW to a SQL Server.
The goal will be to use the Management studio as well and to send the data from SAP BW (Cube or Query) to the sql server.
1. Could you please advice steps by steps how to do the istallation?
2; Which connectors should i use?
3. Is there any document which provide the tools, drivers, connectors to be used?
4. Is there any how to which can help after the installation to run the scenario?
Thank you in advance for your Input.
Cheers
GiloHello,
What you request can be done with DB Connect.
A good starting point is the following link :
[http://help.sap.com/saphelp_NW04/helpdata/en/58/54f9c1562d104c9465dabd816f3f24/content.htm|http://help.sap.com/saphelp_NW04/helpdata/en/58/54f9c1562d104c9465dabd816f3f24/content.htm]
Also I recommend to search further on SDN because there are some interesting posts on connecting BW to external databases like SQL Server.
Wim -
How to connect SQL server using JRun
I am relatively dumb into Java. I am running JRun server in Unix box, and I need to connect to the SQL server (full marks for guesssing that SQL server is on the Win2K box).
Now I want to connect to the SQL server from Jrun using JSPs.
Question:
1. Is JDBC:ODBC only way to connect to the SQL server, if yes -
2. Do I have to create a DSN on the server for the JDBC:ODBC bridge to work
3. Can I write my own database connection package,
Appreciate if any body can help me with this problem, and if you have written a package to connect to the database, then would be nice if you would let me try the same.
If you have any responses, please email me at [email protected]
Thanks in Advance for the anticipated help.
Viviar PrasadHi Prasad,
There is two ways(what I have done) to connect to sql server in jRun..
1) using your jdbc - odbc connectivity using your type one jdbc driver..
2) using type 4 driver.. (type 2 and 3 are not available right now for sql server)
in 1 you have to create an dsn and use it directly in program bypassing jrun management console(I mean u don't have to configure for that)
in 2 case you need to use jrun proprietery driver for the jdbc... there is a problem here..
this driver is available in Jrun 3.0 enterprise edition only and still has got some problem so you need to apply service pack-2 to your Jrun installation and need to download the driver.. jdbc driver from following link
ftp://ftp.allaire.com/kbftp/jrun/all/jrun_drivers.jar.zip
this will suply a html doc along with the driver . which will explain you how to apply..
you can download jdbc driver specilly for sql server from this link http://www.j-netdirect.com/jsqlconnect2_26.zip
but it will expire in a month..
any way once you have obtain any of the above driver, follow these step to configure jdbc in jrun.. you need to put the driver in the classpath..
1 - open your management console
2- select the webapplication for which you want to configure from left frame of mc(management console)
3- select jdbc data source click the add button and follow the wizard..
for more info ref to jrun quick start configuring jdbc settings that came with your JRun..
or you can directly click the link there and type
the name of the
first
datasource(you have supply any name you will be using that to access db in your java prog)
second name of the the jdbc driver
for Jrun it's
allire.jrun.jdbc.JRunDriver
for net direct
com.jnetdirect.jsql.JSQLDriver
third
url for jrun driver
jdbc:jrun:sqlserver://hostname:portno/databasename = dbname; USER = uname; Password = password
where dbname is your database name
uname is your sql server user name e.g sa
password is your password for the corresponding user name
where hostname is the name of the computer where your sqlserver is running it could be an ip e.g 10.0.0.32:1433
1433 is the default port no for the sqlserver if you are using tcp protocol to connect to the sql server
url for net direct
jdbc:JSQLConnect//hostname:port/databasename=dbname; USER =uname; Password = password
for any more information on this you can mail me in this id
[email protected]
All the best..
regards
Bishwa -
Two databases in one system how to connect sql
Hi all
Plz help me I have two data bases installed on my system Oracle
9i n Oracle 10g my problem is when I go on command prompt n connect to sql it always connect with 9i but me want to connect with Oracle 10g plz help me how it
possible I have Windows xp professional
ArshadHi Arshad,
You need to check your PATH environment variable in Windows.
You can check that the path will first point to your 9i installation by entering SET in your dos command prompt.
Then, change the PATH first entries to first your 10g /bin folder.
Otherwise, you can:
* set ORACLE_HOME= <10g home location>
* then enter: %ORACLE_HOME%\bin\sqlplus.exe <connect string>
When your question is answered, please mark your thread as ANSWERED and eventually point which post was helpfull or correct
HTH,
Thierry -
How to connect SQL Dev to local database?
Hi all,
I have a local database on my laptop. I connect to the database using direct connect without passing the listener and tnsnames.ora, because I shut it down.
How can I connect my SQL Developer to the database using direct connect?
ThanksI don't think this is possible because even the basic connection type requires to give a hostname, port number and Oracle SID:
http://download.oracle.com/docs/cd/E18464_01/doc.30/e17472/dialogs.htm#BACEDDJF -
Hi, <BR>iam useing hyperion essbase 6.5.i check my essabse server is working for sql file.its working.but the problem is when ever is able to import sql oracle data data preparation window it say that "sql source is not availble".one more thing is i create one odbc dsn also? <BR>if any one tried it send the details how can i solve the problem
Hello,
Please do the test I mentioned above. Try to get connected using SQL Server Management Studio first.
Please enable TCP/IP and Named Pipes protocols.
https://msdn.microsoft.com/en-us/library/ms191294(v=sql.100).aspx
Configure Windows Firewall or disable it.
https://msdn.microsoft.com/en-us/library/cc646023(v=sql.100).aspx
Open SQL Server Configuration Manager and make sure SQL Server service is started.
Hope this helps.
Regards,
Alberto Morillo
SQLCoffee.com
Maybe you are looking for
-
i've tried downloading the latest version of itunes for pc atleast 3 times, each time i get a message saying that the files are corrupt and to try downloading them again...which i did. is there something wrong with the source files or is it something
-
Info as to whether or not a blind copy has been sent
Sometimes I like to recheck whether or not I have blind copied someone. When checking my sent mail, there doesn't seem to be any indication if this has actually been done. Is there a way to check on this??
-
File splitter won't accept some text files
sorry, this is in the wrong place is there any way i can move it to general programming? i'm making a file splitter to split large text files into smaller parts. so far everything works as far as test files that i make, however, sometimes when i copy
-
List VIs inside 2010 executable
Hi all, I have an application where I would need to get a list of VIs present in a folder which is inside the current application (executable). But the 'List Folder' funtion returns an error when trying to do this. This link provides a way to list th
-
How to delete memory parameters ?
I have newly installed SAP system on windows platform successfully. I am doing post-steps now... As per SAP note 88416 - Zero administration memory management as of 4.0A/ Windows I want to change PHYS_MEMSIZE parameter, but note says 1st delete belo