Hi,
Can anybody help? It's about summing up the elements of column called Gyujtemeny and then column Duplak of a table of an Access database and presenting the result using ASP code. So each column is sum up by its own not one with the other.
<%@ Language="VBScript" %>
<% Option Explicit %>
<html>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset='iso-8859-2'">
<HEAD>
<FONT SIZE=4><TITLE>Kinder Katalógus</TITLE></FONT>
</HEAD>
<BODY LINK="#ff0000" VLINK="#0000ff" BGCOLOR="#eeeeee">
<FONT SIZE=5><P> Kinder <%response.write Ev%> </P></FONT>
<TABLE BORDER CELLSPACING=1 CELLPADDING=7 WIDTH=984>
<TR><TD WIDTH="50%" VALIGN="TOP">
<FONT SIZE=2><P>Gyűjtemény</FONT></TD>
<TD WIDTH="50%" VALIGN="TOP">
<FONT SIZE=2><P>Duplák</FONT></TD>
</TR>
<TR>
<TD>
<%
'declare your variables
Dim connection, recordset
Dim sSQL, sConnString, Ev
Ev = request.querystring("submit")
if Ev = "" Then
Response.Write ("Nincs még ilyen adatbázis !!!")
Else
sSQL="SELECT SUM(Gyujtemeny) FROM tbl_" & mid(Ev,3,4) & ""
End if
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("Kinder.mdb")
Set connection = Server.CreateObject("ADODB.Connection")
set recordset = Server.CreateObject("ADODB.Recordset")
connection.Open sConnString
recordset.Open sSQL,connection
Set recordset=connection.execute(sSQL)
'If there are records then loop through the fields
'else error message
If NOT recordset.EOF then
Response.Write recordset(0)
Else
Response.Write("Az adatbázis ÜRES!!!")
End If
recordset.Close
connection.Close
Set recordset = Nothing
Set connection = Nothing
%>
</TD>
<TD>
<%
Ev = request.querystring("submit")
if Ev = "" Then
Response.Write ("Nincs még ilyen adatbázis !!!")
Else
sSQL="SELECT SUM(Dupla) FROM tbl_" & mid(Ev,3,4) & ""
End if
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("Kinder.mdb")
Set connection = Server.CreateObject("ADODB.Connection")
set recordset = Server.CreateObject("ADODB.Recordset")
connection.Open sConnString
recordset.Open sSQL,connection
Set recordset=connection.execute(sSQL)
'If there are records then loop through the fields
'else error message
If NOT recordset.EOF then
Response.Write recordset(0)
Else
Response.Write("Az adatbázis ÜRES!!!")
End If
recordset.Close
connection.Close
Set recordset = Nothing
Set connection = Nothing
%>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>
Got as error:
Error Type:
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/darabszam.asp, line 40
Any idea?
Cheers,
Tibor