473,387 Members | 1,578 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

ADODB error from JS

Hi,
I have an ASP page on an intranet IIS server that posts data via a
System DSN to an Access DB, normally it works fine however sometimes it
returns 0 for success but no data is added to the DB!?

Dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "DSN=testmain"
sql="Insert Into testtable (Survey_1,Survey_2)
VALUES ("
sql=sql & "'" & Request.Form("Survey_1") & "',"
sql=sql & "'" & Request.Form("Survey_2") & "')"
on error resume next
conn.Execute sql,recaffected
if err<>0 then
Response.Write(" Survey NOT Added! ")
else
Response.Write("<h3>" & recaffected & " Survey Added </h3>")
end if
conn.close
Set conn = Nothing
%>
The above is cut down version as there are a lot of fields!

Anyone know why it would return 0 sometimes but not add the data?

thanks

Adrian
Jul 20 '05 #1
4 3093
Hi,

Adrian wrote:
Hi,
I have an ASP page on an intranet IIS server that posts data via a
System DSN to an Access DB, normally it works fine however sometimes it
returns 0 for success but no data is added to the DB!?

Dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "DSN=testmain"
sql="Insert Into testtable (Survey_1,Survey_2)
VALUES ("
sql=sql & "'" & Request.Form("Survey_1") & "',"
sql=sql & "'" & Request.Form("Survey_2") & "')"
on error resume next
conn.Execute sql,recaffected
if err<>0 then
Response.Write(" Survey NOT Added! ")
else
Response.Write("<h3>" & recaffected & " Survey Added </h3>")
end if
conn.close
Set conn = Nothing
%>
The above is cut down version as there are a lot of fields!

Anyone know why it would return 0 sometimes but not add the data?

thanks

Adrian


You're very much off-topic here. Your code is VBScript on ASP. Ask a VB
newsgroup, or an ASP newsgroup, or both.

Laurent
--
Laurent Bugnion, GalaSoft
Webdesign, Java, javascript: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jul 20 '05 #2

"Laurent Bugnion, GalaSoft" <galasoft-LB@bluewin_NO_SPAM.ch> wrote in
message news:3F1FF4DF.4030304@bluewin_NO_SPAM.ch...
Hi,

Adrian wrote:
Hi,
I have an ASP page on an intranet IIS server that posts data via a
System DSN to an Access DB, normally it works fine however sometimes it
returns 0 for success but no data is added to the DB!?

Dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "DSN=testmain"
sql="Insert Into testtable (Survey_1,Survey_2)
VALUES ("
sql=sql & "'" & Request.Form("Survey_1") & "',"
sql=sql & "'" & Request.Form("Survey_2") & "')"
on error resume next
conn.Execute sql,recaffected
if err<>0 then
Response.Write(" Survey NOT Added! ")
else
Response.Write("<h3>" & recaffected & " Survey Added </h3>")
end if
conn.close
Set conn = Nothing
%>
The above is cut down version as there are a lot of fields!

Anyone know why it would return 0 sometimes but not add the data?

thanks

Adrian


You're very much off-topic here. Your code is VBScript on ASP. Ask a VB
newsgroup, or an ASP newsgroup, or both.

Laurent
--
Laurent Bugnion, GalaSoft
Webdesign, Java, javascript: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Opps Sorry!
Jul 20 '05 #3
In article <bf*******************@news.demon.co.uk>,
Ad*************@NOSPAMhotamil.com enlightened us with...
Hi,
I have an ASP page on an intranet IIS server that posts data via a
System DSN to an Access DB, normally it works fine however sometimes it
returns 0 for success but no data is added to the DB!?

Dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "DSN=testmain"
sql="Insert Into testtable (Survey_1,Survey_2)
VALUES ("
sql=sql & "'" & Request.Form("Survey_1") & "',"
sql=sql & "'" & Request.Form("Survey_2") & "')"


You aren't testing to be sure the values are there.
Blanks count as values. And if it isn't filled in at all, it gets the
empty string. Are you sure it isn't inserting blanks/null?

Dim s1
s1 = Request.Form("Survey_1")
s1 = s1.Trim()
If s1.Len < 1 Then
Error
End If

--
-------------------------------------------------
~kaeli~
Black holes were created when God divided by 0.
Not one shred of evidence supports the notion
that life is serious.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------
Jul 20 '05 #4
Hi Kaeli
Thanks for your reply, good point, but alas not the case as no record is
added not even a blank one! in fact some of the fields are Drop downs so I
would and do get records with just the defaults. but the problem I have it
comes back 0 so no error is generated and the user thinks they have
completed the form OK!!!

thanks

Adrian

"kaeli" <in********************@NOSPAMatt.net> wrote in message
news:MP************************@nntp.lucent.com...
In article <bf*******************@news.demon.co.uk>,
Ad*************@NOSPAMhotamil.com enlightened us with...
Hi,
I have an ASP page on an intranet IIS server that posts data via a
System DSN to an Access DB, normally it works fine however sometimes it
returns 0 for success but no data is added to the DB!?

Dim conn
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "DSN=testmain"
sql="Insert Into testtable (Survey_1,Survey_2)
VALUES ("
sql=sql & "'" & Request.Form("Survey_1") & "',"
sql=sql & "'" & Request.Form("Survey_2") & "')"


You aren't testing to be sure the values are there.
Blanks count as values. And if it isn't filled in at all, it gets the
empty string. Are you sure it isn't inserting blanks/null?

Dim s1
s1 = Request.Form("Survey_1")
s1 = s1.Trim()
If s1.Len < 1 Then
Error
End If

--
-------------------------------------------------
~kaeli~
Black holes were created when God divided by 0.
Not one shred of evidence supports the notion
that life is serious.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------

Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Patrick | last post by:
I understand that with IIS5.1 on Windows XP Professional SP1, I can 1) Either set under IIS Manager-> Any specific Virtual Directory-> Configuration->Options->ASP Script timeout for all pages...
0
by: Dot Netizen | last post by:
I am having trouble passing an ADODB.Recordset from a VB6 application to a VB.Net class library using COM Interop. I am running this on XP SP2 with the .Net Framework 1.1 and MDAC 2.8 SP1. I've...
5
by: Simone | last post by:
Hello I hope you guys can help me. I am very new to ADO... I am creating a ADODB connection in a module and trying to access it from a command button in a form. Function fxEIDAssgn(plngEID As...
0
by: Andre Azevedo | last post by:
Hi all ! I've created a .net serviced component with only one method. This method receive an ADODB.Command object and execute it. The ADODB.Command object is created in the client process. (VB...
0
by: ASP.Confused | last post by:
The old message looked a little stale, so I am re-posting it here. Anybody have any ideas of what I could do?!? The previous responses to this question are below. If you want to look at the...
3
by: Joe Befumo | last post by:
I'm getting the following error in my application: Compiler Error Message: BC30002: Type 'ADODB.Connection' is not defined. Source Error: Line 112: if(Request.Form("HdnQuestionCount") =...
6
by: Wonder | last post by:
We have a VB.NET project with a reference to ADO 2.5 When I open it on my machine, I get the following build error: "The referenced component 'ADODB' has an updated custom wrapper available." ...
4
by: T | last post by:
-------------------------------------------------------------------------------- I tried this audit trail code, using 2003 and it works great, I try and use it at work w/97 and it blows up:...
3
by: vinuthan | last post by:
Hi, Can anybody send me the driver file of "adodb-sql.inc.php" which i need to put in my system in the below path. C:\RTH\rth_1.6.1\adodb-4.65/drivers/adodb-sql.inc.php as i am getting below...
5
by: muriwai | last post by:
Hi, I have a C# assembly project under Visual Stuio 2008 Pro on Windows Server 2008. I converted the project from VS 2005. The project references COM->Microsoft CDO for Windows 2000 Library...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.