techzone12
Technical User
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
<%@ 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