Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 191
  • Last Modified:

How can I run insert query in ASPs?

I want to develop a database using Active Server Pages.I want to give input through HTML form.Database is in MsAccess.
0
ali123
Asked:
ali123
1 Solution
 
ali123Author Commented:
Please Help me...
0
 
sybeCommented:
<%
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now