help on DATA REPORT dynamic fields
im using MS-SQL and im developing a program, there is a situation that i need to ALTER table in sql meaning creating a dynamic field, my prob is, is there anyway to show in DataReport the dynamic fields i created in the database using the program? thx more power!!
Re: help on DATA REPORT dynamic fields
Not sure I understand what you want to do.
But if your asking if you can assign the Data Field property at runtime then the answer is, Yes.
rptAssessment.Sections("users_header").Controls.Item("name").DataField = "fullname"
"fullname" is a field from the Data Member property
I usually do this in Datareport "report_initialize" event.
You can also set the Datasource, Data Member properties and many other things.
Good Luck
Re: help on DATA REPORT dynamic fields
example:
product_id, Price field in products table in SQL, then in the program ,when i press add product, the code is ALTER TABLE product_tbl " & _
"ADD [" & Combo1 & "] varchar (50) NOT NULL default '0'"
how can i make a datareport that will show the product name and price?
also there is a delete product ALTER TABLE product_tbl " & _
"DELETE [" & Combo1 & "] varchar (50) NOT NULL default '0'"
and how can i remove the field in the datareport when i delete the product?
sample program will be appreciated ?thx more power
Re: help on DATA REPORT dynamic fields
Are you saying that all the products and prices are kept in one record instead of one record for each product? Is there only one record in this table?
What would be the max amount of products? Are you trying to list them all on one line of the report?
Need to know the report format you are trying to achieve, but for I can give a help example.
Re: help on DATA REPORT dynamic fields
theres a table named productname ,fields =product_id,productname when you add a product it will be saved there and in another table named product_price the productname will be altered thus creating a field named after it and in that field the price will be saved,
Re: help on DATA REPORT dynamic fields
i can get the query now ,example "select test1,test2,test3 from test_tbl"
problem is how to get this dynamic fields in the datareport.
Re: help on DATA REPORT dynamic fields
Quote:
theres a table named productname ,fields =product_id,productname when you add a product it will be saved there and in another table named product_price the productname will be altered thus creating a field named after it and in that field the price will be saved
Sorry I still don't understand what you are trying to achieve. It seems like your storing all the data in one record, instead of an unique record for each product.
But either way, you can add all the text boxes needed to the report then assign what is to be displayed in the boxes at runtime, as shown in my first reply. If your asking if text boxes can be added to the report at runtime then my answer is, NO, I've never found a way. Maybe someone else knows how to but I don't.
Good Luck