Solved

How can I run insert query in ASPs?

Posted on 1998-11-01
2
139 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now