I am facing a problem while fetching SQL Server data using ASP.NET Core with Dapper method.
I have a views with 3 varbinary(max) columns with 800 records, which executes under 2 seconds in SSMS.
But in .NET Core, it is taking around 1 minute to return the result.
Please see Dapper data access methods I tried below.
Method 1:
var data = await connection.QueryMultipleAsync(command);
Method 2:
var data = await connection.QueryAsync<ModelName>(command);
Can anyone help me to solve the issue?
Which is the fastest Dapper method to fetch varbinary(max) data with same time as in SSMS?
The short answer is that they should not have any difference in performance, and since they have, there must be something else happening, but it is not possible to tell what as you haven't provided a repro of the problem.
If you are new to Dapper, my recommendation is to take a look a this tutorial I wrote. You'll get your answers: https://medium.com/dapper-net/multiple-executions-56c410e9f8dd
The full tutorial is here: https://medium.com/dapper-net/dapper-net-tutorial-summary-79125c8ecdb2
Related
There is a requirement in my project where we need to design a system which can collect data through Web API and then use the data to compare and copy the received data to an existing SQL Server DB. I want to know if anyone has already worked on such requirement and if yes then what is the best way to design it? I am currently thinking of below two options. Please let me know which one is better and if there is any other option.
My algorithm will be as - fetch the data through web api -> compare the data -> save mismatched data to a particular table -> copy new data to the existing tables.
The two options I am currently thinking of are-
1) Use a windows service which will run once in a day and execute above algo.
2) Use SSIS package which will run once in a day and execute above algo.
If anyone has used either of this solution, please guide me to an article or blog which can be helpful to me.
I have similar project requirement before. What I achieved is in SSIS.
Brief steps:
Using C# script to get the return data (http://json2csharp.com/ is an easy way to return C# class based on your JSON components)
using third party dll, install Newtonsoft.Json to deserialize the JSON
Assign the results in C# script to each pre defined variable (be careful with the data type)
Compare the result with the existing table in data flow task.
Let me know if you have any questions
To give you the question first: I want to know if it is possible to create a stored procedure or something in SQL Server that intercepts and translates SELECT, INSERT, and UPDATE commands. Now for the explanation:
I am writing a web application to replace an old desktop app. Its a business app which is basically a database interface with reports and searches and all the good ol' CRUD. The new and old apps need to live in harmony together since some customers may be using the old and new together to access the same DB.
My problem is that the original database format stores most data in a single blob of text (1 nvarchar(MAX) field). I want to add functionality to search on fields stored in the blob, but it will be cumbersome and slow. I would like to update the database format without changing the desktop app at all, hence the question above.
It occurs to me that I could do this on the client by writing a wrapper class for the data access object and then do a bulk replace in the client code to reference the wrapper, but I want to know what my options are on the server as well.
In case anyone wants to know, the old app is in VB6 and the new in C#.
EDIT
Alright, so it looks like if I do anything on the server side we are looking at adding stored procedures and then updating the client VB6 code to reference the stored procs. Do something like a bulk replace of SELECT with sp_oldselect ... To return the data in a different format. I'm guessing a client-side wrapper would be the best solution for the time-being. Old apps die hard.
You can create a bunch of views for the old client and let it to query those views. It will be slow as hell in most cases, but it can 'replace' the select query. For updates and insert.. well.. instead of triggers on the views could help is some cases, but it will require lots of processing.
However my suggestion is to provide exactly the same functionality in the web app and deprecate the desktop app. When the desktop app's share is low enough, stop supporting it. From this point, you are (mostly) free to add new functions, upgrade the database schema, etc.
I agree with JonH, that alot can go wrong here, but you can try and read up on the INSTEAD OF Triggers in MS SQL server here: https://technet.microsoft.com/en-us/library/ms179288(v=sql.105).aspx
I'm using IBM webexperience factory 8.0. with fixpack. In my project I'm using Webservice Multiple Operations builder. It is having different operations with different result schema. When I try to assign the result of an operation to a Datapage it is showing the same result schema for all the operations.
Actually the return values of these operations should be different but it is showing the same.
Please refer this link for the screenshot.
How can I solve this issue.
I have a form which contain some textfields and one attachment(type="file"). I am using MS Access 2010. When i am trying to insert form data into database i am getting error like An INSERT INTO query cannot contain a multi-valued field.I tried a lot and searched a lot but i couldn't figure out. I am able to do it using asp.net. But, My server supports only classical asp. Can anyone have any idea about this.
I don't believe you can make use of an MS Access attachment field using ADO. I believe you need to use DAO or ADO.Net. And I don't think DAO or ADO.net are available in Classic ASP.
Edit: I agree with Hansup, that you might be able to use DAO in VBScrip/Classic ASP but I'm finding it very difficult to find any information or examples. Here's a list of constants but this is for an older version of DAO. http://include.wutils.com/com-dll/constants/constants-DAO.htm
I have found many samples and examples of silverlight applications that use EF for their data store. Why is it that every single one uses a database full of data and shows how to edit/save? I'm having problems setting up an application where I (want to) have no data to start with and would like my user to then populate the data store. Everything works fine when data exists but I get into all sorts of null problems when I want to start with no data.
Just saying...
ANyway, my question: Does anyone know of any tutorials that demonstrate code where no data yet exists?
Thanks!
(Sorry for my bad english)
I suppose you are using RIA Services? That's the easiest way to develop an SL app with EF. It should make no diference between having data or not, the RIA Service returns a collection with 0 or more itens, you bind that with a DataGrid and are done. Here is a link with source code of a full aplication, that starts with no data: http://johnpapa.net/wcf-ria-services-hands-on-lab - What is most important to understand is the asynchronous nature of RIA Services. Keep that in mind, take a look and try the code.
If you have more questions, try to be more specific about the exact errors or problems you are facing, it would be easy to others try to help you :)