Solved

Add records to sql sever database through asp.net website - visual studio 2008

Posted on 2013-11-11
3
396 Views
Last Modified: 2013-11-13
I'm using Visual Studio 2008 and firstly create asp.net website. I can connect to the information in SQL Server database using dataview or gridview and can query a particular entry (ie. Eqipment Id. -brings up all details linking to that Equipment).
I can then edit the details of that Equipment and this would update the SQL Server Db.
What I need to do is to have a form that simply enters new details for a new Equipment. ie. Enter Equipment Name:   [__] Enter Serial Number: [__]. Then for this to update the database. By using the gridview or dataview I am able to view all fields that exist in the table and edit them. Is there a way that I can get a blank gridview/dataview template (which includes all the fields in the table) and fill it out to then update the database?
0
Comment
Question by:cookiejar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 78

Expert Comment

by:arnold
ID: 39640719
Your asp app needs to have a form with the fields.
Your existing code needs to be modified to display a blank form rather than query the database and then populate the data in the response.
0
 

Author Comment

by:cookiejar
ID: 39645089
Could you direct me to a good tutorial that will show me how to do this?
0
 
LVL 78

Accepted Solution

by:
arnold earned 500 total points
ID: 39645994
Without understanding what you currently have, I am guessing based on what you posted.

It sounds that your current rendering is based on a query into the database and then building out the form to present to the user.
One way to maintain this and get what you want is to query such that you do not get any valid responses but only have the fields.

The tool you are using to consrtuct these presumably has an empty form

<form action=processdata.aspx>
<input name=column>
<input type=submit
</FORM


http://www.w3schools.com/aspnet/aspnet_forms.asp has
Look for any ASP.net guide.  There are many sites on the web that provide access to the books that provide introduction/examples of constructing.
make sure to take into account that your current code suggests that it is likely open to SQL injection.  Deals with whether the data you receive from the web site, is being directly pumped into the sql server such that a well placed ' could terminate the execution of your sql query and then will process the directives that follow that well placed (').
0

Featured Post

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question