Solved

How can I run insert query in ASPs?

Posted on 1998-11-01
2
160 Views
Last Modified: 2010-04-09
I want to develop a database using Active Server Pages.I want to give input through HTML form.Database is in MsAccess.
0
Comment
Question by:ali123
2 Comments
 

Author Comment

by:ali123
ID: 1839345
Please Help me...
0
 
LVL 28

Accepted Solution

by:
sybe earned 100 total points
ID: 1839346
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DSN=MyDatabase"

' ========================================
' example 1, using an "insert" sql statement

strSQL = "INSERT into TableName (field1,field2) values ('test','test')"
Conn.Execute(strSQL)

' ===================================
' example 2, using an updatable recordset

Set RS = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM TableName"
RS.Open strSQL, Conn, 1, 3

RS.AddNew
RS("field1") = "test"
RS("field2") = "test"
RS.Update
RS.Close

%>
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

770 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