Home | Advertising Info8 USERS CURRENTLY ONLINE   
PowerASP
   Site Search Contact Us Monday, May 06, 2024  

  Active InfoActive Info  Display List of Info MembersMemberlist  Search The InfoSearch  HelpHelp
  RegisterRegister  LoginLogin
Classic ASP - Database Issues
 PowerASP Code Help Area : Classic ASP - Database Issues
Subject Info: Insert info into table A d d  -  P o s tAdd P o s t
Author
Message << Prev Info | Next Info >>
luishurtado
Newbie
Newbie
Avatar

Joined: April/04/2006
Location: Netherlands Antilles
Online Status: Offline
Info: 1
Added: April/04/2006 at 4:13pm | IP Logged Quote luishurtado

Hello there. Yoday my issue is this:

I do have a websiete, which is runing ASP. Inside there I do have an ACCESS db, where I want the visitors to be able of filling in a subscription form. For that I created already the form. The point is that I am getting an error (internal server error), when the ASP page is trying to write the information into the database.

Previously I had the same time of error, and it was corrected by the use of the following code.

Is there anybody who can give me a clue about this?





<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<p><img src="CDPC%20Logo%20Med.jpg" width="250" height="223"></p>
<p>&nbsp;</p>


<%
Dim Conn
Dim Rs
Dim sql
'Create an ADO connection and recordset object
Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.Recordset")
'Set an active connection and select fields from the database
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("webissuelogboek.mdb")
'sql= "SELECT Satisfied1, Satisfied2, Satisfied3, Satisfied4,SomewhatSat1,SomewhatSat2,SomewhatSat3,SomewhatSa t4,Neutral1,Neutral2,Neutral3,Neutral4,SomewhatDis1, SomewhatDis2,SomewhatDis3,SomewhatDis4,Dissa1,Dissa2,Dissa3, Dissa4, Dtae, Student FROM TbIssue;"
sql= "SELECT * FROM TbIssue;"

'Set the lock and cursor type
Rs.CursorType = 2
Rs.LockType = 3

Rs.Open sql, Conn 'Open the recordset with sql query

Rs.AddNew 'Prepare the database to add a new record and add
Rs.Fields("Satisfied1") = session("Satis1")
rs.fields("Satisfied2")= session("Satis2")
Rs.fields("Satisfied3") = session("Satis3")
Rs.Fields("Satisfied4") = session("Satis4")
rs.fields("SomewhatSat1")= session("SomSatis1")
Rs.fields("SomewhatSat2") = session("SomSatis2")
Rs.Fields("SomewhatSat3") = session("SomSatis3")
rs.fields("SomewhatSat4")= session("SomSatis4")
Rs.fields("Neutral1") = session("Neutro1")
Rs.Fields("Neutral2") = session("Neutro2")
rs.fields("Neutral3")= session("Neutro3")
Rs.fields("Neutral4") = session("Neutro4")
Rs.Fields("SomewhatDis1") = session("SomDisa1")
rs.fields("SomewhatDis2")= session("SomDisa2")
Rs.fields("SomewhatDis3") = session("SomDisa3")
Rs.Fields("SomewhatDis4") = session("SomDisa4")
Rs.Fields("Dissa1") = session("Disa1")
rs.fields("Dissa2")= session("Disa2")
Rs.fields("Dissa3") = session("Disa3")
Rs.Fields("Dissa4") = session("Disa4")
Rs.fields("Date") = Now()
Rs.Fields("Student") = session ("Name")


Rs.Update 'Save the update
%>


<%
Rs.Close
Set Rs = Nothing
Set Conn = Nothing
response.redirect ("http://www.cdpc.net/issuelogboek/project.asp")
%>
Back to Top View luishurtado's Profile Search for other info by luishurtado Visit luishurtado's Homepage
 
firas_TheGeek
Newbie
Newbie
Avatar

Joined: May/27/2006
Location: Oman
Online Status: Offline
Info: 28
Added: May/27/2006 at 7:58am | IP Logged Quote firas_TheGeek

i had the same problem before, the solution is easy

after opeing the connection u must start a transaction and before u close the connection u must end that transacation in order to save the data in the db

after :

Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("webissuelogboek.mdb")

type:

Conn.BeginTrans

 

 

then before:

Set Conn = Nothing

type:

conn.CommitTrans
conn.close

 

 

at the end ur code should look like this

 

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<p><img src="CDPC%20Logo%20Med.jpg" width="250" height="223"></p>
<p>&nbsp;</p>


<%
Dim Conn
Dim Rs
Dim sql
'Create an ADO connection and recordset object
Set Conn = Server.CreateObject("ADODB.Connection")
Set Rs = Server.CreateObject("ADODB.Recordset")
'Set an active connection and select fields from the database
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("webissuelogboek.mdb")

Conn.BeginTrans


'sql= "SELECT Satisfied1, Satisfied2, Satisfied3, Satisfied4,SomewhatSat1,SomewhatSat2,SomewhatSat3,SomewhatSa t4,Neutral1,Neutral2,Neutral3,Neutral4,SomewhatDis1, SomewhatDis2,SomewhatDis3,SomewhatDis4,Dissa1,Dissa2,Dissa3, Dissa4, Dtae, Student FROM TbIssue;"
sql= "SELECT * FROM TbIssue;"

'Set the lock and cursor type
Rs.CursorType = 2
Rs.LockType = 3

Rs.Open sql, Conn 'Open the recordset with sql query

Rs.AddNew 'Prepare the database to add a new record and add
Rs.Fields("Satisfied1") = session("Satis1")
rs.fields("Satisfied2")= session("Satis2")
Rs.fields("Satisfied3") = session("Satis3")
Rs.Fields("Satisfied4") = session("Satis4")
rs.fields("SomewhatSat1")= session("SomSatis1")
Rs.fields("SomewhatSat2") = session("SomSatis2")
Rs.Fields("SomewhatSat3") = session("SomSatis3")
rs.fields("SomewhatSat4")= session("SomSatis4")
Rs.fields("Neutral1") = session("Neutro1")
Rs.Fields("Neutral2") = session("Neutro2")
rs.fields("Neutral3")= session("Neutro3")
Rs.fields("Neutral4") = session("Neutro4")
Rs.Fields("SomewhatDis1") = session("SomDisa1")
rs.fields("SomewhatDis2")= session("SomDisa2")
Rs.fields("SomewhatDis3") = session("SomDisa3")
Rs.Fields("SomewhatDis4") = session("SomDisa4")
Rs.Fields("Dissa1") = session("Disa1")
rs.fields("Dissa2")= session("Disa2")
Rs.fields("Dissa3") = session("Disa3")
Rs.Fields("Dissa4") = session("Disa4")
Rs.fields("Date") = Now()
Rs.Fields("Student") = session ("Name")


Rs.Update 'Save the update
%>


<%
Rs.Close
Set Rs = Nothing

conn.CommitTrans
conn.close


Set Conn = Nothing
response.redirect ("http://www.cdpc.net/issuelogboek/project.asp")
%>

 

 

 

you have another problem, is the internal server error
this page doenst show you the reall error you have to disbale it in order to give ou the reall erre and the line where it is happeing

to show the reall error follow the steps in the picture

and when u press OK

refresh the page, and whenever there is an error it will display the real error with the line where the error had accured

 

Hope this helps

Tell what happens with u

Best Regards

 



__________________
Firas S Assaad (TheGeek)
firas489@gmail.com
0096892166434
http://firas-thegeek.blogspot.com
Back to Top View firas_TheGeek's Profile Search for other info by firas_TheGeek Visit firas_TheGeek's Homepage
 

If you wish to make a comment to this info you must first login
If you are not already registered you must first register

  A d d  -  P o s tAdd P o s t
Printable version Printable version

Info Jump
You cannot add new info in this area
You cannot add to info in this area
You cannot delete your info in this area
You cannot edit your info in this area
You cannot create polls in this area
You cannot vote in polls in this area

   Active Server Pages Rule The World
Contact Us  
All artwork, design & content contained in this site are Copyright © 1998 - 2024 PowerASP.com and Christopher J. Williams
Banner ads ,other site logos, etc are copyright of their respective companies.
STATS Unless otherwise noted - All Rights Reserved.

Active Server Pages ASP control controls class classes module script Scripts applet CJWSoft ASPProtect ASPBanner ASPClassifieds www.aspprotect.com, www.cjwsoft.com,www.aspclassifieds.com,www.aspphotogallery.com