Solved

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

Posted on 2013-11-11
3
394 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

696 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