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
Related
Im a newbie for such programming like reports/visualizations si I´m here just to ask for some advices, resources, tutorials..
The main goal of my new focus is to create custom charts/visualizations within really small time. Right now I have made some kinds of reports for Machines Overview, Machines Availability or OEE. These are made in MS SSRS (SQL Server Reporting Services). This kind of reports creating is pretty good, also very limited and not modern. The procedures in SQL server are already written and at least everything I have to do is transform these data to a newer modern design (kinda innovative internal business project)
I started studying ASP.NET MVC 2 months ago to create these charts as a web app. Searched hours for tutorials and videos on youtube, but there are no proper tutorial to visualize data directly from database. Found chart templates for MVC e.g.:
link: https://canvasjs.com/asp-net-mvc-charts/stacked-column-chart/
Here I can find the main source code for the whole chart but the values that´s being showed are strongly typed. I´m trying to figure out how to show exact values from database. I would like to know how to assign exact values for axis X and Y + values calculated from stored procedure.
In visual studio followed the instructions from various tutorials how to create WebForms, MVC website etc. Everywhere they were showing local/strongly typed values.
I need 1 solution for reports where everything is prepared in SQL, there just needs to be somehow connected from database to chart.
Like in the mentioned link there is a controller window where should be maybe some {get; set;} statement from database with same column name as in SQL DB.
We are using
SQL Server 2015
SQL Management studio 2015
SQL Server Reporting Services (SSRS)
MS ReportBuilder
the code to show can be expected in the mentioned link from canvas.js link for the whole MVC chart.
Reports:
I´m looking for a specific solution where I found specific charts (e.g.: canvas.js) what I have to edit and how, to use our data in specific charts. I´m interested in so bad because later in future my department will focus on creating custom specific charts for customer requirements.
Visualization:
Same goal as in Reports. Actually the visualization in production is just mentioned as "visualization" at least it´s just a report which has inside an html meta tag for 30sec autorefresh. I would like to know some other method where the data change could be asynchronous (I have heard something about React for this?)
If what you want is visualize data directly from database, you should look for a BI or business intelligence tool such as Power BI, SAS, SAP, etc.
If you plan to make them your own through a web app and you want to use ASP.NET MVC then you'd really have to study some Javascript, HTML, and MVC itself. What needs to happen is;
From your ASP.NET MVC web app, inside your Controller you need to get the data from the database. Search ADO.NET if you think Entity Framework might take some time.
Now that you have data in your Controller, it's time to pass them to the View. Search ViewBag or ViewData if don't want to use Strongly typed models.
Now that the data is inside the View, it's time to use Javascript or Jquery to loop through that data and pass them to the Charts javascript library you mentioned.
you can try dotnet Report builder https://www.dotnetreport.com and see if it works for your requirements. It’s very fast, installs with just a nuget package and some configuration. Sounds like exactly what you need. Full disclosure, I’m affiliated with the company.
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 want to import data by giving the searching option in c#. I am using SQL server database to save this data. Please help me what would I use and how to proceed. I think whether I would use a Google search API or a web crawler. I tried for Google search API but this is not helpful.
Very little information, you need to make sure that when you are creating posts that you clearly specify what you are attempting to do and what code you already have. You'll find that just asking how to do something isn't received well by the SO community, try and when you fail, we'll help.
Now, I'll give you a nudge in the right direction with what you are trying to do. Read up on how to incorporate SQLDataReaders into your application. Link below:
http://www.dotnetperls.com/sqlcommand
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.
I need a bit of guidance or pointing towards some tutorials for storing webpage content within a database and for that data to be displayed as and when requested. I touched on storing data within grid views etc, but i cannot get my head around how i would store all the CSS and display alot of content in a web page style as opposed to grid view.
Whilst i understand the prinicples of the dynamic driven websites, i have been unable to find a real clear cut tutorial to guide me through the basic process. For e.g. should i use data entities, or a list view etc? I have my DB tables created, and my page layouts created i just need to store the data and call it when needed.
Any help would be greatly appreciated.
Why re-write something that has been done many times before? What you're looking for is a Content Management System; there are many to be had from free to costly, and I'm sure you could find something that would meet your needs.