Skrive til DB
HejJeg har her en kode der kan vise indholdet af mindatabase, Jeg har problemer med at skrive til den. Er der nogen der kan rette koden til da der f.eks. skrives et navn direkte i tabellen.
Her er koden:
<%
'**** Create an ADO connection object *******
Set objConn = Server.CreateObject("ADODB.Connection")
'**** Set an active connection to the Connection object using a DSN-less connection ******
objConn.Open="hcb_scales_tutorial"
'****** Create an ADO recordset object *******
'****** Initialise the strSQL variable with an SQL statement to query the database ******
Set objTutorials = Server.CreateObject("ADODB.Recordset")
'**** Get select statment for the connection. ***
strSQL = "SELECT * FROM personer ORDER BY personer.ID"
' **** Open the recordset with the SQL query
objTutorials.Open strSQL, objConn
%>
<table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td>
<h1><span lang="da">Display Database</span></h1>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="1" cellpadding="4">
<tr>
<td width="3%"><B>nr.</B></td>
<td width="20%"><B>Name</B></td>
<td width="20%"><B>Telephone</B></td>
<td width="20%"><B> Birthday</B></td>
</tr>
<% blnChangeColor=false%>
<% if objTutorials.BOF=true and objTutorials.EOF=true then%>
<h1> No data has been found in Period <b>
</b>
<%
else
arrData=objTutorials.GetRows ()
arrSize=ubound(arrData,2)
if isarray(arrdata) then
for kk=0 to arrSize
if blnChangeColor=true then
%>
<tr>
<td width="3%" bgcolor="#DDE9F5"><%=arrData(0,kk)%></td>
<td width="20%" bgcolor="#DDE9F5"><%=arrData(1,kk)%> <%=arrData(2,kk)%>
<td width="20%" bgcolor="#DDE9F5"><%=arrData(3,kk)%></td>
<td width="37%" bgcolor="#DDE9F5"><%=arrData(4,kk)%></td>
</tr>
<%
blnChangeColor=false
else
%>
<tr>
<td width="3%" bgcolor="#ffffff"><%=arrData(0,kk)%></td>
<td width="20%" bgcolor="#ffffff"><%=arrData(1,kk)%> <%=arrData(2,kk)%>
<td width="20%" bgcolor="#ffffff"><%=arrData(3,kk)%></td>
<td width="37%" bgcolor="#ffffff"><%=arrData(4,kk)%></td>
</tr>
<%
blnChangeColor=True
end if
next
else
end if
end if%>
</table>
</table>
<%'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''%><%
objTutorials.Close
set objTutorials=nothing
set objConn =nothing
%>
