its my first time using fastreport, i am using FR with a asp.net web api, after searching i have decieded to get the data from db using stored proc. and get whatever pass whatever filter im using from the report from the front-end to the api (example like a certain Id of the object i wanna create a report for) and then pass this value to the stored proc. i export to the FR and pass this value to my parameters, i don't know if this is the best way to use FR with my api so i'm open to any suggestions. Now my main problem is that i have json obj in my SQL DB for localization(ex: the Name obj is stored like that {"en":"TestAcc2","fr":"test"}) so how can i convert a certain language from a field like this to show in the report, i have found resources on how to deal with a whole json DB but i only want to deserlizae this field so any help on how i could do it ?
Related
I recently made a monopoly game using C# Winforms and now I need to convert it to a web application. I'm using ASP.NET and I'm having some issues with variables being reset on button clicks.
In order to resolve this, I was planning on having all data stored within a SQL Server database whenever it is changed, and then retrieved when needed. The main issue is that I have 2 classes, Square and Player.
I can handle the data for player fine but each square has a Player associated with it called "Owner". I'm just wondering if there is any way that in the SQL Server database I can set the data type for "Owner" to the "Player" class so that I can save that along with all the other data. Thanks in advance.
SQL Server was designed for and works best for structured tabular data. For complex objects, this usually means it takes several records over several tables to represent a single object.
However, what you are trying to do is store a complex object in a single column in SQL Server. You can do this in SQL Server, by serializing your object to a string (usually XML or JSON) and storing the string representation of your object in an nvarchar(max) column in SQL. When you fetch the record, deserialize it back into an object. You lose quite a bit of power in SQL Server when doing this, but if you don't need to manipulate the data within your object server-side, then it works fine (you can do limited XML and JSON processing within SQL server, but from the sounds of what you are doing, you won't need to).
One of the easiest and most popular ways to serialize objects is to use Newtonsoft JSON. Add the NuGet package for Newtonsoft, and then serialize your objects by calling string myComplexObjectAsAString = JsonConvert.SerializeObject(myComplexObject);. You can send that string to SQL, and when you get it back, use MyComplexObjectType myComplexObject = JsonConvert.DeserializeObject<MyComplexObjectType>(theStringDataThatYouGotFromSqlServer);
I was given a report today with a normal embedded data set (dataset1) and data source (datasource1) but the data set query is just a number: '1411'. The previous programer manually entered fields (not calculated fields) into the field tab.
When I click RUN, it works.
How is it populating the page without a proper query?
-There is only 1 tablix called (table1.) It also is pointing to dataset1.
-In Report Properties there is no VB code.
-RDL XML: Under dataset1's tag:
<DataSourceName>datasource1</DataSourceName>
<CommandText>=1411</CommandText>
I see no other SQL listed. Could there be something else on the server that's triggering it?
What sort of data source is "datasource1"?
If it's an RDBMS, check if there is a stored procedure or function in the database with the name "1411".
In SQL Server for example you could conceivably have a stored procedure called [1411] that returned a data set.
I'm assuming we are talking RDL (Report Definition Language). You might open this report with your favorite text editor and look at the CommandText XML tag to find the associated query. Hope that helps.
I am using ASP.Net webform for my development and currently implement datatables.net. to perform some excel like data entry job. For more info, please go to http://datatables.net/release-datatables/extras/KeyTable/editing.html. I also added some add row and delete row functions at client side. Now I am stuck on how to push the entire table data to the server. It's look like excel and user can make the amendment. Whenever they plan to save the data, the user just need to click on save button and the entire table info shall be submitted to the server. For your information, no input textbox in this case because I am using keytable feature.
Please help!
Thanks.
I believe this datatables.net server side usage page has sServerMethod which may be fullfill your requirement. The data are passing in JSON format to server. In server side you can parse the JSON back to your DTO to update your data.
You can SqlBulkCopy for faster insertion of data in the database. You can search code for that on net.
You'll need to create an object collection of some kind in your handler to temporarily save the data into some kind of structure or object. What I did was append a row_id to the table row in the fnRowCallback of the Datatable, then grabbed it in the submitdata property of the Editable plugin, sending it to the server. Once there, I store it in an object, add it to the collection, and let editable update the table.
When you are ready to submit, fire it off, go to the handler, and send all of the data in the collection to the server as a mass update.
I'm new to MyBatis and my project requires me to read the data from the Oracle database, populate the objects, reset the data if necessary and insert it back into the database.
I'm trying to read data of a nested table. The nested table column consists of a collection of Oracle defined Custom Objects. To be more specific each record in the table is associated to a collection of Custom Object and the Custom Object consists of three fields namely nickname, date of birth and address.
I'm actually getting an oracle.sql.ARRAY data type when trying to retrieve the data. The problem I have here is that I'm not able to map this oracle.sql.ARRAY which is being fetched by the JDBC through MyBatis to my objects. All I'm able to do is get the ARRAY cast it to an object array and then to a Struct and iterate through the attributes to get the values.
I can always hand build the beans, but I know its not an efficient way of doing it. I want to configure my result map in a way that it populates my objects. But, I have not been able to do that so far. If anyone has any advice regarding this issue please help me out.
I think you can get this to work with a custom TypeHandler.
In your ResultMap, do something like this:
<result property="arrayOne" column="array[1]" typeHandler="customArrayHandler" />
<result property="arrayTwo" column="array[2]" typeHandler="customArrayHandler" />
Then in your CustomArrayHandler.getResult() implementation, you can parse the real column name and index out. Then retrieve the array from the ResultSet and get the needed value from the index.
That would require a lot of Oracle specific code in Mybatis and I know they have tried to avoid RDMS specific code in general. I would write your own data mappers to map the arrays to whatever model objects you need.
I am using GridView in asp .net and editing data with edit command field property (as we know after updating the edited row, we automatically update the database), and I want to use transactions (with begin to commit statement - including rollback) to commit this update query in database, after clicking in some button (after some events for example), not automatically to insert or update the edited data from grid directly to the DB...so I want to save them somewhere temporary (even many edited rows - not just one row) and then to confirm the transaction - to update the real tables in database...
Any suggestions are welcomed...
I've used some good links, but very helpful, like:
http://www.asp.net/learn/data-access/tutorial-63-cs.aspx
http://www.asp.net/learn/data-access/tutorial-66-cs.aspx
etc...
Well,
you can store your edited data in a DataTable in session. and then pass this data table as a bulk insert in to the database. 2 options are available for this
if you are using SQL Server 2005 you can use OpenXML to achieve this, as i have stated here
if you are using SQL Server 2008 youc an use Table Variables like i did here.
i hope it helps
First way:
Create session variable that will contain your DB object (DataTable or mapped objects).
The GridView should work with this instance instead of sending the data to the database.
Once editing is finished you may take the object from the session and save it in the way you normally do.
Second way:
I would use javascript to collect all changes on the client side while he is editing as a array of objects (each object is separate row).
Once the editing done, you can create json string from the collection and pass it to the server.
If your json object configuration is same as server class then you can use JavaScriptSerializer to deserialize your string into collection of object.
After that, you can save your objects in the way you normally do.