Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to update Table in dB with new data

Status
Not open for further replies.

techzone12

Technical User
Aug 24, 2005
32
0
0
US
I have this code that displays the results of a select query:

<%@ LANGUAGE="VBSCRIPT" %>
<% Option Explicit%>
<HTML>
<body>

<%
' Open Database connection
'***********************************************
DIM objConn, dbname, data_source
Set objConn = Server.CreateObject("ADODB.Connection")
'data_source = "Provider=SQLOLEDB; Data Source= EnergyServer.com; Initial Catalog = energy_data;User ID=someID; Password=SomePswrd "

objConn.Open data_source

Dim strSQL
strSQL = "select DateStamp, ColName1, ColName2 from table"

Dim objRs
set objRs = Server.CreateObject("ADODB.Recordset")
objRs.Open strSQL,objConn

Response.Write "<table border=1 align=center cellpadding=3 "
Response.Write "cellspacing=0><thead><tr>"

dim fldF
For Each fldF in objRs.Fields
Response.Write "<td><b><font color='#0033CC'>" & fldF.Name & "</font></b></td>"
Next
Response.Write "</tr></thead><tbody>"

Do until objRs.EOF
Response.Write "<tr>"
For Each fldF in objRs.Fields
Response.Write "<td>" & fldF.Value & "</td>"
Next
Response.Write "</tr>"
objRs.MoveNext
Loop

objRs.Close()
Set objRs = nothing

objConn.Close
Set objConn = Nothing

%>

</BODY>
</HTML>


I woulk like to make it possible for the user to edit the fields displayed in the ASP page. After editing a specific, that is uniquely identified by a DateTime key, the user will hit submit. Once Submit is hit the table in the dB will get updated with the new data?

Thanks


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top