I have a small website with couple different forms inserting data to sql. But the users have problem with it. The problem is that they seem to be going through them too fast that its not recording everything.
So i am trying to see if there was a way to store all the data locally and have it insert to sql at the end when they are done filling out forms. Is this possible?
For example:
I have a form that have 5 fields but 2 are auto populated and 1 entered manually and 2 are being inserted using bar code scanner. The bar code scanner is the last value required before being inserted, so i was hoping there was a way to insert that into locally store access database (not seen by anyone) and when they press "Finish" all that data from access will be inserted into sql.
Hope i painted the picture clear enough.
Let me know any and all possibilities.
EDIT: Here is the aspx and .cs, hope this helps. Yes i realize that i have validation for the bar code, but not sure why its slow. And i may have stuff cluttered. So please bear with me.
Sounds like you need to put that data in application session or cache and then flush the data to db.
Here are some other choices though:
Flat files (simply serialize your objects, use protobuf)
Use Embeded Db: SqlLite, VistaDb, Sql Server Compact...
Store data in the browser via localstorage (dom storage, this is html 5 feature)
Related
As a DBA/SQL Server Developer, I'm often asked to produce web pages where users can view the data in the database and edit them, and see the edits they've made straight away (without refreshing the page). I know nothing about ADO.NET or C#, but I would like to be able to give users this very simple functionality. Essentially I'm looking for three things:
to display a table of data in a webpage retrieved from a SQL Server stored procedure
to display a text box in the same webpage where users can input data
to display a button in the webpage that takes the inputted data from the text box, runs it through the stored procedure as a parameter, and refreshes the table.
Ideally I'd like this all to happen without the user having to refresh the webpage.
My questions are: is this kind of thing possible? How difficult is it to achieve? And how do I do it? I don't have the time to learn web development in full. I wouldn't need the vast majority of skills I'd learn even if I did learn it in full. I just really need this basic functionality, to produce ultra simple pages when user requests come in.
If anyone knows of any examples of just this kind of thing, that I can copy, they would be greatly appreciated!
You don't really need to use MVC, WebForms or even C# for that matter. Using one of those would be killing a ant with a rocket launcher.
Look into node.js and pug, using a RESTFUL API to deliver the information you need. I don't believe you will need more than two hours to provide your users with the interface you told us.
Node has a awesome package called express, it sets up everything for you and uses Pug on the starter template.
You can check out a tutorial right here.
Actually it will also take 2 hours doing with Webforms or MVC . I recommend using Entity Framework to make it super simple.
Webforms may be a bit older technology but will be faster to develop this specific page (assuming you only targeting Desktop users). Otherwise MVC is the way to go.
You can Check the tutorial.
https://learn.microsoft.com/en-us/aspnet/mvc/overview/getting-started/introduction/getting-started
I'm working on a web page that should display huge amounts of data in a GridView.
Obviously I would use some sort of paging.
What I want to know is the best way of doing such a thing, what is the norm?
Should I connect to database each time for every page of GridView? Should I connect to database one time for the first page and load the rest of the data in some kind of background task? Should I load a few pages of data in advance, in the background, to lessen users waiting time?
Any advice is appreciated.
Do keep in mind I'm relatively new to programming and thank you!
Just compare the probability of getting full set of your data for your users first to choose appropriate solution:
if the chance that user need your second page not a big (last news, relevant search results, etc) - do not load all your data. Just load first page only.
if your data are processes sequentialy and they are dependent, so you really know taht after first page user should/must proceed to next page - review solution to load your data for next page in backgroud thread while user works with data of current page (process tasks or documents, approve orders, etc).
if your solution means - your users can randomly navigates to pages in your grid and do this very often (each user need to visit at least several pages randomly) - review solution to load all data into cache and generate pager using cached local data.
Hope this helps.
Use virtualization of Control you use - any grid or lists! Thats important and #1
Set a middle-tier service, that helps you to loads from DB only visible +/- few rows up and down. You can do it via cursors in query, or a much simpler via LINQ extensions wirh .Skip(count) and Take(count) -- that can helps you how many rows you realy read from which position of set (or you can see with LinqPad how it can be transformed in T-SQL if you don't use any ORM)
Don't sort or filter your set on Control (grid or listvew), do it via query on DB side - its a lot times faster(!) with their indexes in DB
Use a SQL Server stored procedure for fetch huge data also send 2 extra parameter paging Page Number, Page Size and return total count from procedure.
Pagination with the stored procedure
have read many article and most of the article suggest httphandler or handler for image binding to gridview from SQL Server.
Is it possible to bind images from database to gridview without httphandler or handler?.
If yes than provide me sample code
My table schema: Table Name:- ImageGallery
Column Name DataTypes
Photo image
The above table stored the images in <Binary data>
Is it possible? Yes. Is it a good idea? Not at all, and here's why. An HttpHandler is a way of providing a virtual URL for the image. This allows the browser to handle the GET requests on its own, in an order that's efficient, and asynchronously. This further means that the initial GET request isn't burdened down with conceivably MB's of images.
The idea of a website is that it's more efficient to make a lot of smaller requests asynchronously than it is to make one massive request. Why? Because you're already at a disadvantage to provide the user with a good experience when disconnected from the server. Adding insult to that injury by making a massive request that could take minutes, isn't going to add to their joy.
Instead of storing image as Binary datatype in database, U can try an alternate Solution.
1. Make the column datatype as varchar or nvarchar.
2. Store your image in a seperate folder.
3. Fetch the url for that Image.
4. Save it in the Database.
5. Now in your gridview mention tha column data according to ur wish.
6. During Runtime the URL will refer to the content and the image will
be displayed in your Gridview.
I'm currently developing a web application (C#, ASP.NET MVC) which going to let users upload there own data by Excel files to the SQL Server database. In most of the cases the Excel files will have more than 2000 rows with 5 columns.
To archive this a was thinking about the following solution the main key is performance:
User uploads a excel file with 2000 rows.
The web application returns the rows from the excel file in json, jQuery will do a validation and some calculations on the values, if the values are invalid he will pop-up with some suggestions. At the end jQuery appends the data to a form (10000 textboxes)
User can make changes and needs to improve the invalid data, and does a submit
The web application uses SqlBulkCopy (with the posted data) to a merge table
Stored procedure will merge it to the final table
Is this a good solution, are there better approaches? Is it possible to post 10000 textboxes at one time?
Thanks!
The first part is fine, but the second step is what gets me. That seems not only like it could be a performance nightmare, but it would definitely be a UI nightmare. The solution I would suggest is let the user know which rows have issues and have them fix them in Excel. You then have the option of either adding the rows that were good, saving the file for later use or just discarding it all together. The other steps look good to me as well.
I'm not aware of a limit to how many textboxes can be added to a web page, but like I said, it will be a UI nightmare when there already exists a platform that can make this easy for the user (Excel).
I would like to have a lot of data (quotes of famous people, arround 100 k quotes). And I want that users are able to search, sort on category and sort on authors.
Got a big big xml file at the moment, but what is smart to do? How can i get all the quotes in the app? maybe a sql lite database? or just loop the xml when app starts?
Any tips are most welcome!
Kevin
UPDATE: Thanks for all the replies and tips, I really appreciate it and I am looking forward to program my App, did make a runkeeper-like app yesterday, now starting the quotes app.
I would recommend storing this data on a webserver somewhere and using some SOAP interface of something like this, to access it. I wouldn't be positively surprised when a downloaded application all of a sudden decides to download a big file of quotes.
I would recommend a SQL CE database (.sdf file)
Great overview here: http://windowsphonegeek.com/tips/Windows-Phone-Mango-Local-Database%28SQL-CE%29-Introduction
And here: http://msdn.microsoft.com/en-us/library/hh202860%28v=VS.92%29.aspx
There's no SQLite on WP7. There's SQL Server Compact though. Read up on the latter, and also on LINQ. WP7.5 only.
Alternatively, store data on the Web server, and use a service to pull it on demand. In that case, read up on services and SOAP.
With the fact that you are looking at a 500mb file I think you have a couple of options.
1) Put all of this data in a database on a webserver, then have your phone application use whatever method you like to contact the database to get specific data that is needed. Obviously your UI would have to be optimised to allow a user to sort by the type of quote and / or the person to whom the quote is attributed.
2) If you want this to be done without the use of the webserver you could have a stripped down basic database of quotes in the application itself, to extend this connect to the database and download more data.
This method may be best as it lets you use the database data to say populate a website if you wanted to (make a bit of money from ad revenue / promote your app) and also it means if your users dont have an internet connection they can still get some use from your app.
Without more knowledge of the platform I couldnt say what would happen if you try load a 500mb application but I doubt it would be good, though having such a large file locally is a bad idea for a mobile device. I can see this going two ways.
1) Im out and see your application, I set it downloading, pay it no attention and then later check to find it has downloaded 500mb over my mobile phone data package. This could mean a big bill.
2) I start to download your application, it hasnt finished downloading after 10mins, I delete it and dont bother trying again.
You can do something like let the user to enter three character minimum before search from webservice ans user the service result to bind the data.
Check the following links
How to connect to a Webservice from a Windows Mobile Device 6.0
http://msdn.microsoft.com/en-us/library/aa446547.aspx
Let me know if this helps.