Programaticaly add Table in CR database fields
Hi to all,
I'm using CR 11.5, Visual Studio 2005-C#,asp.net and SQL server 2005.
My work is during runtime to add the Fieldobjects in
crystal report now i can do it but during design time i added
the Table in Crystal Report ->FieldObjects>Database Fields
by that programaticaly i can add the Fieldobjects.
What i try to do is
to add the table to CR Database fields by programaticaly.
Is this possible then experts please help me.
Thanks in advance
I found a way like this
private void AddTableFromDataSet(ref CrystalDecisions.CrystalReports.Engine.ReportDocument rpt, System.Data.DataSet ds)
ISCDReportClientDocument rasReport = rpt.ReportClientDocument;
// Convert the DataSet to an ISCRDataset object (something the ISCDReportClientDocument can understand)
CrystalDecisions.ReportAppServer.DataDefModel.ISCRDataSet rasDS;
rasDS = CrystalDecisions.ReportAppServer.DataSetConversion.DataSetConverter.Convert(ds);
// Add the dataset as a data source to the report
rasReport.DatabaseController.AddDataSource((object)rasDS);
// Add a field to the report canvas
// Note: This is quick and dirty. No positioning, resizing, formatting, etc.
CrystalDecisions.ReportAppServer.Controllers.ISCRResultFieldController rfc;
CrystalDecisions.ReportAppServer.DataDefModel.ISCRTable crTable;
CrystalDecisions.ReportAppServer.DataDefModel.ISCRField crField;
rfc = rasReport.DataDefController.ResultFieldController;
crTable = rasReport.Database.Tables[0];
crField = crTable.DataFields[2]; // Hardcoded field "Customer Name" in the Customer table from Xtreme Sample Database
rfc.Add(-1, crField);
// Save the report template to disk (without data)
//object path = @"c:\documents and settings\administrator\desktop\";
//rasReport.SaveAs("test.rpt", ref path, 0);
//MessageBox.Show("Done!");
Similar Messages
-
Cannot alter or add table in my database.
I have database i am using already. The system will not allow me to alter a table
nor allow me add a table. Prior to that, I could alter or add a table. Now, if I
alter or add a table i get errors in my app. When I check, I see that the changes
vanishes or the table is dropped. I need someone to help me out.And an other one:
http://social.msdn.microsoft.com/Forums/en-US/4ef7702a-30c7-4750-8f44-73dcbc04467b/atltered-table-reverts-back-to-its-old-form-or-newly-created-table-gets-dropped-after-making?forum=sqldisasterrecovery
My guess is:
- You have create a MS Visual Studio Project for C# or VB.NET
- In you project you have created a "Service based database", and not directly in SQL Server
- You created some tables, added some data and your Project / application worked fine
- You made some modification on your database / tables and when you start you project, it crashes because the new tables / columns are missing.
Am I nearly right?
The resaon is: The database will be started as a "user instance" of SQL Server, and for this a copy of the database file is used, which is located in "YourProject\bin\Debug\" Folder; just to prevent to damage the database during testing.
For the database file you can define what happens on build process: "Always Copy", "Copy if newer" or "never copy"; I guess you set the last option and so you will always work with an old copy of your database file in debug mode.
Olaf Helper
[ Blog] [ Xing] [ MVP] -
How to add a DataBase Field in PLD from a User Defined Table
Hi All,
Please tell me how should i add a database field in PLD from User Defined Field...
The DropDown for tables in the Property window does not shows the User Define tables...How should i see them...
Thanx in Advance
ManishIn PLD choose object Database. Then press Alt + table combobox, this will show the UDT. Then choose the column.
-
Database Fields Verify Database - By Programaticaly
Hi to all,
I'm using Crystal Report 11.5, Visual studio 2005 - C#,Asp.Net2.0.
My task is by programaticaly add the
Fieldsobjects,Blobobjects and so on. So in design time i just
add the Datatable in the CR,
but during runtime i add some columns in database Table and i get that newly added column but unable to add this field
(Raised error as "Field Not Found") so what i tried is during
design time in
Field Explorer>Database Fields>Right Click and Select
Verify Database after this work my page is working fine.
My questions is how to do the same work programaticaly.
Experts please explain.
Thanks in AdvanceYes i found the way it's very simple
ReportDocument boReportDocument = new ReportDocument ();
boReportDocument.VerifyDatabase();
Thats all -
How to add a new data element for existing table filed(Primary key field)
Hi Experts,
How to add a new data element for existing table field(Primary key field)
For this filed ther is no foreign key relation ships and even check table.
while activating table it is giving message like below.
can you help any one to solve this and wil steps to add new dataelement for existing primary key filed of a table.
Check table (NAMING SPACE/TABLE NAME(EX:/TC/VENDOR)) (username/19.02.10/03:29)
Primary key change not permitted for value table /TC/VENDOR
Check on table /TC/VENDOR resulted in errors
Thanks
RaviHi,
Easiest way is to download the table eg into an Excel table (if possible) or text table. Drop the table from the database. Build your table with the new key field. Build the database table again and fill it.
You can do it also over the database into a new table. Drop the old one. Build the enhanced one and fill it. Afterwards drop your (temporary) table.
Maybe there are other ways, but this works.
Success,
Rob -
Could not add a database field in the new PLD report..
Hi All,
Am working on a PLD report and am not able to add a Databse field on the Report.
I want to add a new field on my Report which should fetch the Field Tax Amount from the table AR invoice tax amount per document....
when i add the new database field the drop down for tables does not display the desired table....
Can any one help me on this....
Thanx in advance
Manish ChaudharyHello,
here is some thread links relate to your problem :
1. Detail of all tax codes and tax amounts in A/R Invoice PLD
2. Calculate Tax breakup in PLD
Rgds, -
Overwrite database record - Table has only 1 field and record
Hi,
How do you overwrite a record in a database table?
The database table that we have only has one field and this field is used to count the print number of a specific label. This table will only have 1 record.
The field is also used as part of an id.
So during each program run, I will select the current number in the field, add to it in my program, then will need to overwrite the current value in the database table with the new value.
Please suggest if something different should be done.
Thanks,
JohnYou will need to do a delete and then insert instead of delete and update. Update wont work in this case.
"Lock DB table
DELETE FROM <DB TABLE> CLIENT SPECIFIED WHERE MANDT = SY-MANDT.
INSERT <DB TABLE> FROM <HEADER>.
"Unlock DB table.
regards,
Advait -
Labview database problem: Create a database table from user defined fields
I am trying to create a new table in an access database opened by an ODBC connection from information entered a table stored in the database, but every time I try to create the table, the Labview Database connectivity toolkit VI for creating a table throws a cryptic error
"Exception occured in Microsoft OLE DB Provider for ODBC Drivers: [Microsoft][ODBC Microsoft Access Driver] Syntax error in field definition. in NI_Database_API.lvlib:Conn Execute.vi->NI_Database_API.lvlibB Tools Create Table.vi->DatabaseCreateHeaders.vi"
I think this is becuase I am trying to re-create the database column variable type, but I am not sure what I am doing wrong. Everything seems to be fine as the data types go, and everything works as long as I use a constant to create the database columns. I even tried putting all of the information into the format labview defined, changed that to a variant, and redefined it as the labview database column type.
I have attached a simplified VI and a picture of what I am trying to
do, but I would appreciate any help I can get. Hopefully I won't have
pulled out all of my hair by the time some one replies!
Solved!
Go to Solution.
Attachments:
DatabaseUserDefinedTable.vi 14 KB
UserDefinedColumns.JPG 48 KBHi everyone. I am new to the database tool kit using labview. I am using labview 9.0f2 on Windows Xp. I am required to create a database (task is to create a table and to insert values into the table using Microsoft access 2007). I am trying to learn using the Create Database table.vi found with the software. I understand that need to create an access file and also had a mdl file which is name after it.(I had created them). Looking at the example given, I would like to add a few more variables, to be exact 6 more variables(therefore i would have 6 colum in my access file rite?). From the "connection information" the help information shows that it contain an 1D array of DB tools colum. ctl and also a cluster of 4 elements. the link to the access file, LabVIEW.udl shows that it restrict the colum in the access file.eg it has only stringcol,intcol,doublecol. I need to add more colum but cant add just like tt.
qn1: How to i add insert more varibles into the database so that it will apprears in access.
qn2: I cant drag and insert the "connection information" just to have more input. how do i do it?
qn3: where can i edit the info so that i can add more cluster into the access? when i drag out the input turn greyish. -
Add data to the table in the database with the use of add button
The name of my database is Socrates.
The name of the table in the database is Employees
I want to be able to add data to the database. i am presently working on the add button such that when i enter date into the textfield and press the add button it should automatically register in the table.
The error upon compilation is with this line of code
If (ae.getSource() == jbtnA)// it says that ";" is expected
Below is the entire code
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Mainpage extends JFrame implements ActionListener
JTextField jFirstName = new JTextField(15);
JTextField jSurname = new JTextField(12);
JTextField jCity = new JTextField(10);
JTextField jCountry = new JTextField(12);
JTextField jSSN = new JTextField(8);
JLabel jFirstLab = new JLabel("First Name");
JLabel jSurnameLab = new JLabel("Surname");
JLabel jCityLab = new JLabel("City");
JLabel jCountryLab = new JLabel("Country");
JLabel jSSNLab = new JLabel("Social Security Number (SSN)");
JButton jbtnA = new JButton ("Add");
JButton jbtnPrv = new JButton ("Previous");
JButton jbtnNt = new JButton ("Next");
JButton jbtnDl= new JButton ("Delete");
JButton jbtnSrch = new JButton ("Search");
public Mainpage (String title)
super (title);
Container cont = getContentPane();
JPanel pane1 = new JPanel();
JPanel pane2 = new JPanel();
JPanel pane3 = new JPanel();
pane1.setLayout (new GridLayout (0,1));
pane2.setLayout (new GridLayout(0,1));
pane3.setLayout (new FlowLayout());
pane1.add(jFirstLab);
pane1.add(jSurnameLab);
pane1.add(jCityLab);
pane1.add(jCountryLab);
pane1.add(jSSNLab);
pane2.add(jFirstName);
pane2.add(jSurname);
pane2.add(jCity);
pane2.add(jCountry);
pane2.add(jSSN);
pane3.add(jbtnA);
pane3.add(jbtnPrv);
pane3.add(jbtnNt);
pane3.add(jbtnDl);
pane3.add(jbtnSrch);
cont.add(pane1, BorderLayout.CENTER);
cont.add(pane2, BorderLayout.LINE_END);
cont.add(pane3, BorderLayout.SOUTH);
jFirstName.addActionListener(this);
jSurname.addActionListener(this);
jCity.addActionListener(this);
jCountry.addActionListener(this);
jSSN.addActionListener(this);
jbtnA.addActionListener(this);
jbtnPrv.addActionListener(this);
jbtnNt.addActionListener(this);
jbtnDl.addActionListener(this);
jbtnSrch.addActionListener(this);
validate();
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
pack();
setResizable(false);
public void actionPerformed(ActionEvent ae)
If (ae.getSource() == jbtnA)
fst = jFirstName.getText();
srn = jSurname.getText();
cty = jCity.getText();
cnty = jCountry.getText();
int sn =
Interger.parseInt(jSSN.getText());
String ad = "Insert into Employees
(Firstname,Surname,City,Country,SSN)" +
"values('"fst"','"srn"','"cty"','"cnty"','"sn"')";
Statement stmt = con.createStatment();
int rowcount = stmt.executeUpdate(ad);
JOptionPane.showMessageDialog("Your
details have been registered");
Statement stmt = con.createStatment();
int rowcount = stmt.executeUpdate(ad);
public static void main (String args[])
Mainpage ObjFr = new Mainpage("Please fill this
registration form");
try
Class.forname("sun.jdbc.odbc.JdbcOdbcDriver");
String plato = "jdbc:odbc:socrates";
Connection con =
DriverManager.getConnection(plato);
catch(SQLException ce)
System.out.println(ce);
}i have restructured the code, but the following line of code is giving error:
String plato = jdbc:odbc:socrates;
the entire code is below:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
public class Mainpage extends JFrame implements ActionListener
JTextField jFirstName = new JTextField(15);
JTextField jSurname = new JTextField(12);
JTextField jCity = new JTextField(10);
JTextField jCountry = new JTextField(12);
JTextField jSSN = new JTextField(8);
JLabel jFirstLab = new JLabel("First Name");
JLabel jSurnameLab = new JLabel("Surname");
JLabel jCityLab = new JLabel("City");
JLabel jCountryLab = new JLabel("Country");
JLabel jSSNLab = new JLabel("Social Security Number (SSN)");
JButton jbtnA = new JButton ("Add");
JButton jbtnPrv = new JButton ("Previous");
JButton jbtnNt = new JButton ("Next");
JButton jbtnDl= new JButton ("Delete");
JButton jbtnSrch = new JButton ("Search");
Statement stmt;
String ad;
public Mainpage (String title)
super (title);
Container cont = getContentPane();
JPanel pane1 = new JPanel();
JPanel pane2 = new JPanel();
JPanel pane3 = new JPanel();
pane1.setLayout (new GridLayout (0,1));
pane2.setLayout (new GridLayout(0,1));
pane3.setLayout (new FlowLayout());
pane1.add(jFirstLab);
pane1.add(jSurnameLab);
pane1.add(jCityLab);
pane1.add(jCountryLab);
pane1.add(jSSNLab);
pane2.add(jFirstName);
pane2.add(jSurname);
pane2.add(jCity);
pane2.add(jCountry);
pane2.add(jSSN);
pane3.add(jbtnA);
pane3.add(jbtnPrv);
pane3.add(jbtnNt);
pane3.add(jbtnDl);
pane3.add(jbtnSrch);
cont.add(pane1, BorderLayout.CENTER);
cont.add(pane2, BorderLayout.LINE_END);
cont.add(pane3, BorderLayout.SOUTH);
jFirstName.addActionListener(this);
jSurname.addActionListener(this);
jCity.addActionListener(this);
jCountry.addActionListener(this);
jSSN.addActionListener(this);
jbtnA.addActionListener(this);
jbtnPrv.addActionListener(this);
jbtnNt.addActionListener(this);
jbtnDl.addActionListener(this);
jbtnSrch.addActionListener(this);
validate();
setVisible(true);
setDefaultCloseOperation(EXIT_ON_CLOSE);
pack();
setResizable(false);
try
Class.forname(sun.jdbc.odbc.JdbcOdbcDriver);
String plato = jdbc:odbc:socrates;
Connection con = DriverManager.getConnection(plato);
stmt = con.createStatment();
catch(SQLException ce)
System.out.println(ce);
catch(ClassNotFoundException ce)
System.out.println(ce);
public void actionPerformed(ActionEvent ae)
try
if(ae.getSource().equals(jbtnA))
fst = jFirstName.getText();
srn = jSurname.getText();
cty = jCity.getText();
cnty = jCountry.getText();
int sn = Interger.parseInt(jSSN.getText());
ad = "Insert into Employees
values('"+fst+"',"+srn+"','"+cty+"','"+cnty+"','"+sn+"')";
stmt.executeUpdate(ad);
JOptionPane.showMessageDialog(this, "Your details have been
registered");
catch(SQLException ce)
System.out.println(ce);
public static void main(String args[])
Mainpage ObjFr = new Mainpage("Please fill this registration form");
} -
How can find database field and table name
how can find the underline database field name,table name from java page. Example. in oracle apps when we go purchaseing super user then supplier base then supplier and find supplier detail .
Hi,
depends on your model. If you work with ADF BC then you can use ViewLinks to access parent or detail infromation programmatically. See the developer guides for more information. Note that you wont access the tables directly but the collections that represent the records
Frank -
Can't add database field or text object to a report (new and existing)
We have Crystal Report 8.5 and when trying to modify an existing report or create a new report, I can't seem to add any database fields or text objects in my report. I get a prohibition symbol (circle with a backslash inside it) when I hover over the report. Has anyone encoutered something like this? Any suggestions? Thank you.
Do you have two monitors?
I had this problem if I tried to open crystal in the second monitor, move it back to primary monitor and it should be OK.
Ian -
Insert Image to table from a Non Database Field
Hallo,
db- 9i EE R2
forms - 6i R2
OS - W2003
I have a requirement to upload Images to the database from forms.
I planned to keep the transaction data and the Images separately in different tables with a reference.
So, I created the Image field (BLOB) with a Non Database Field in the Form and use a button to upload the Image. (using READ_IMAGE_FILE).
I tried to insert the Image to the Actual Image table in PRE-INSERT Trigger at block level.
But I was not able to Insert the using reference method. (Cannot compile the PRE-INSERT)
INSERT INTO IMAGE_TB (ID,IMAGE)
VALUES (IMAGE_SEQ.NEXTVAL, :ITINERARY_MAP.IMAGE);
So, Please help me to insert a image to different table from a Non Database Field?
ThanksI don't think it will work with a non-db-item. But you could create a separate block based on your image_tb-table, use read_image_file on the then db-based-column and then simpy issue a commit_form.
-
How can I add table fields with existing structure ?
I like to add PSTLZ field to stucture KOMGG.Is it possible to add table field with the existind structure.If yes how can I do this?kindly help me on this.
hi
go to se11
in change mode select the button append
create new append which starts from Zpstlz in this komgg structure and add data element and domain to this field and activate with request number
then in field catalogue this field should be visible ,here ends your append
now it is ready to use in condition tables.
reward if helps !!!!! -
How to add the contents of a field of internal table.
Hello Everybody,
How to sum up the individual field from a internal table. Like i have a internal table that has menge field , I need to sum up the menge field for each matnr..
exm : for each matnr there are 5 menge entries, I need to add all the menge fields and shud be put against the matnr .
Thanks,Hi Khaleel,
One more option is using the "collect" statement.....
imagine in the internal table itab..we have 2 fields only..
MATNR,MENGE,
we have 2 internal tables itab1 and itab2...
loop at itab1.
collect itab1 to itab2.
endloop.
Action performed is ...for the same MATNR...menge gets added and saved as a single record...When matnr changes...new record is Appended
another case is we have 3 fields in internal table
MATNR,UNIT,MENGE
imagine we hane the records
Material1 KG 100
Material1 LT 20
Material1 LT 200
MAterial2 KG 100
in this case...the output will be
Material1 KG 100
Material1 LT 220
MAterial2 KG 100
Reason is that the fields before the addable value is checked for similarity..
here field UNIT is also checked and also MATNR before adding up....
Hope it gave you some alternative idea to proceed with....
Reward if helpful
Regards
Byju -
Hello,
I'm in the process of converting an Access 2010 database into a web database and I'm having some trouble. I have a table which has 236 fields, which is more than the 220 field limit for web-compatible tables. I have tried to split this table into two tables
with a one-to-one relationship, but web tables can only use lookups as relationships. I've tried to connect the tables with a lookup and then synthesize a one-to-one relationship by using data macros but I'm not having much luck.
I realize that 236 fields is a lot, but it must be set up this way because each field represents a tasks and is a yes/no box to verify that the task has been completed - and the records are different employees for whom which the tasks need to be completed.
Could someone please help me figure out a way to make this table web compatible?
Thank you,
RyanHi,
I found that you've cross post the quesion on our Answer forum, are you satisfiled the reply from there?
http://answers.microsoft.com/en-us/office/forum/office_2010-access/access-2010-table-has-too-many-fields-for-web/06ee81ea-24ab-48b8-9b8f-0ed08a868bac
Regards,
George Zhao
TechNet Community Support
Maybe you are looking for
-
Backing up and restoring Keychain file
How can I backup the Keychain file and also load it on another mac? Thanks.
-
I had to reformat my C: drive and reinstall winxp. I copied the firefox folder from my c drive be fore I formate the drive. And put in on my storage drive D: Is there a way of getting my bookmarks back out of the firefox directory on my D: drive and
-
My pc will not recognize my zen micro. I have reinstalled softwear, but it still does not see player. In device manager it sees it as an unknown device with no drivers. I can not figure out what to do. It is useless if I can not load any mp3s to list
-
Web font not displaying in Muse
Hi! Seemingly out of nowhere, Source Sans Pro will not display in design mode in Muse 2014. To see the font correctly, I need to preview in browser. I also can't see the formatting (bold, etc.), though it's there. Any help appreciated!
-
Applications on MacBook run slow since upgraded from Tiger to Snow Leopard
I have upgraded my MacBook from Tiger to Snow Leopard. After the upgrade, my Mac runs very slowly and it takes several minutes to load a program. I cannot use my graphic softwares and firefox properly, because it takes several minutes to actually sta