I have a database running in SQL server that I can edit/add/ retrieve information from with no worries. I just have a question about the best way to lay out the database in this situation.
Say I have a database stored with the columns
Score, DateTime, Comment
but when I want to display the table to the user I want them to see a table that has
Ranking (just 1-25 or so), Score, Time Since, Comment
What is the best tool to use in visual studio to achieve this?
I have been trying to use GridView which I figured made sense but I have trouble creating the ranking column and the time since column. What is the best way to achieve this?
Also when I adjust some algorithm to sort the comments by score and time since, where do I put this? In the C# or is there some way to incorporate this into the database?
Thanks a lot for the help!!
EDIT: It's an ASP.NET web form application
Use SSRS (Reporting Service) and use the TOP filter in your grid.
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 am a total beginner of ASP.NET. I have created a webform in Visual Studio and now I need to figure out how to make the webform submit the data to a record in SQL. I assume there are thousands of tutorials out there for this but I can't seem to find any. Everything I find seems wildly over-complicated to just simply write data to a record. (or maybe its just my lack of understanding .NET that makes it seem over-complicated.)
I dont need to exchange data, or update live data on a page form the db, I just need to write the data to a record.
Can anyone point me in the right direction?
You could use the scaffolding feature to generate your application.
All you need to do is setup your connection string (pointing to your database) and follow this tutorial (http://www.c-sharpcorner.com/UploadFile/4b0136/getting-started-with-web-forms-scaffolding-in-Asp-Net/).
As simple as this!
Follow this link: http://mrbool.com/inserting-data-into-sql-server-database-using-csharp-and-asp-net/25091
or this link
http://www.c-sharpcorner.com/Blogs/12611/easy-steps-to-insert-data-into-sql-server-using-Asp-NetC-Sharp.aspx
This is frustrating me to no end. I need to create a report based off a SQL query to be displayed in a report viewer on an asp page. Seems like it would be simple but I can't seem ti find an example of how to accomplish this. I don't need a stored procedure I need something I can add variables to like stringbuilder. The user will give an input and then the report will populate based off the query that the input was passed too. Simple seems like but anything dealing with a report seems to want the wizard. What can I do to get a report that looks good and I can use a sql query to bind data to? Thank you in advance.
You can use Gridview to display table from a database. A good start can be read here and here.
Please give us some additional info on what you need so that we can able to help more. :)
I'm quite busy reading different posts over how to create reports from dynamic queries. I have the next problem and maybe someone here can help me with this:
I have a class where I can create a dataGridView from a dynamic dataTable in a project made with C# from VS 2010. I populate my DataTable with one of 9 different linq queries that I have according to the user requirements, which also are saved in a register in my database. Starting from this point, I need to make a report where I can show of the same way the data selected.
I have found the code from the website got ReportViewer and it works quite good. Only I have a last problem. I need my report to show a chart according to the parameters passed via the DataTable. I saw the examples that they have there for the charts but they work quite restrict with what I need, and the code for the chart generator that is incluided in the Dynamic Table project is quite extense and a bit complex for a beginner like me.
Do you know any other examples that maybe I can find to use to make the code in my project? Many thanks in advance :).
I found another way to do it:
Now I'm using classes as datasources and filling arrays of these classes with the contect of the datatable.
I pass these arrays as my datasources for the project.
I group my data by the number of fields I want to display and then I choose between pre made .rdlc files where I show my data to the user.
I have been given an assignment that requires dynamically creating many web data entry pages mostly in questionnaire form.
I am using visual studio 2008, aspnet , c#3.5 and sqlserver 2005.
The questions are hierarchical and are stored in sqlserver with hierarchy info and info on which questionnaire(s) they belong to.
Some questions require answers via radio button y/n/na and some require an int as input.
I was thinking of using listview or gridviews (bound to the database with a sqldatasource that filters the questions for the questionnaire being generated) for the data entry.
One listview or gidview would contain the question and a column of radio buttons. I would have to loop thru it row by row to save the data in the db.
The other listview or gidview would have a column bound to a integer column in the db. An inline edit would update the db automatically.
Is there a tool that does this? Preferably with a gui that the enduser can use to enter, edit and change the order and hierarchy of the questions?
Open source is best, but a reasonably priced tool is ok also.
Any other suggestions are also appreciated.
I am doing something very similar for a sitefinity website. Unfortunately the poll module that comes out of the box with sitefinity does not meet the requirements for a questionnaire.
Found a good post here in SO.
There are some survey engine toolkits in the market.
Here are some:
http://www.mentor-logic.com/index.php/products/components/zodiacnet
http://www.classapps.com/SelectSurveyFeatures.asp
http://www.novisystems.com/
http://www.nsurvey.org/
Open source:
VoteControl
NetPolls - The web poll engine
I might do this purely with XML. Use an XML query to SQL server to retrieve the hierarchical information as XMK, then use XSLT to transform the XML into the correct HTML (or XHTML).