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>&nbsp; Kinder <%response.write Ev%> &nbsp;</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

Recommended Answers

All 7 Replies

i think sSQL value comes empty. try to put response.write for EV & sSQL values and see

#
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

I received this error message when i insert some data in access using ASP?
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
/example/processForm.asp, line 15

this is because of access MDB is in read only mode. please give write permission for that

i think sSQL value comes empty. try to put response.write for EV & sSQL values and see

#
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

Hi,

Yes thank it turns that "Ev" comes empty. Then i find the root of problem and now it is working.
Thanks for the idea again.

Cheers,
Tibor

Thank you for replying to my question but i don't know how to change the permission.
Can you solved me out ? because i have to complete my project within 10 days. I use access frequently.

Right click on access MDB file and you can see checkbox for read only checked. remove that check mark and apply.

its already removed. what next to do?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.