Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > ADODB error from JS

Reply
Thread Tools

ADODB error from JS

 
 
Adrian
Guest
Posts: n/a
 
      07-24-2003
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


 
Reply With Quote
 
 
 
 
Laurent Bugnion, GalaSoft
Guest
Posts: n/a
 
      07-24-2003
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

 
Reply With Quote
 
 
 
 
Adrian
Guest
Posts: n/a
 
      07-24-2003

"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!


 
Reply With Quote
 
kaeli
Guest
Posts: n/a
 
      07-24-2003
In article <bfor4m$cei$1$(E-Mail Removed)>,
http://www.velocityreviews.com/forums/(E-Mail Removed) 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
-------------------------------------------------
 
Reply With Quote
 
Adrian
Guest
Posts: n/a
 
      07-24-2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> In article <bfor4m$cei$1$(E-Mail Removed)>,
> (E-Mail Removed) 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
> -------------------------------------------------



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error Type:0x80040E57 and ADODB.Command error '800a0d5d' ern edwar ASP General 0 11-15-2005 06:50 PM
Object reference error in ASP.NET application using ADODB.dll just_jt ASP .Net 0 12-03-2004 01:05 PM
ADODB.connection safety settings error Steven Baeten ASP .Net 1 05-09-2004 10:57 PM
ADODB.Connection error '800a0e7c' PJ ASP .Net 1 10-30-2003 01:27 PM
COMException Unspecified Error with ADODB and .NET remote users Jim Lacenski ASP .Net 1 10-18-2003 07:51 AM



Advertisments