Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Newbie Recordset empty checking error
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

neerajdeo
Starting Member

USA
33 Posts

Posted - 29 April 2002 :  06:05:34  Show Profile  Visit neerajdeo's Homepage  Send neerajdeo a Yahoo! Message
Hello
I have the following code

sSQL = "SELECT Section_No, Detailed FROM Summary WHERE SNo = 1"
Set result = oConn.Execute(sSQL)
detail = result("Detailed")
if Trim(detail) = "" then
detail = "Detailed information is not available for this section"
end if
Response.Write(detail)

-----
My problem is that if result("Detailed") is empty then it is showing a blank instead of showing that no information is available for this section. Where did i go wrong (the feild is of type text)
It is guranteed that only one record (row) will be returned for this query.

The row as such is never empty because Section_No is primary and has something.

Please Help



Edited by - neerajdeo on 29 April 2002 06:15:08

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 29 April 2002 :  06:32:14  Show Profile  Send ruirib a Yahoo! Message
Maybe because of the difference between the parts in red?

quote:

sSQL = "SELECT Section_No, Detailed FROM Summary WHERE SNo = 1"



-------------------------------------------------
Installation Guide | Do's and Dont's | MODs
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 29 April 2002 :  07:24:08  Show Profile
Seems like ruirib is right. But it might also be the difference between Empty and Null ?? Maybe ??

Nikkol
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 29 April 2002 :  09:32:52  Show Profile  Visit Gremlin's Homepage
Aye like nikkol said could be becuase that field actually contains null rather than just being empty (yes there is a difference)

try


sSQL = "SELECT Section_No, Detailed FROM Summary WHERE SNo = 1"
Set result = oConn.Execute(sSQL)
detail = result("Detailed")
if Trim(detail) = "" or isNull(detail) then
detail = "Detailed information is not available for this section"
end if

Response.Write(detail)



www.daoc-halo.com
Go to Top of Page

neerajdeo
Starting Member

USA
33 Posts

Posted - 29 April 2002 :  09:40:28  Show Profile  Visit neerajdeo's Homepage  Send neerajdeo a Yahoo! Message
Well SNo denoted serial no. There is no relation betweem SNo which is numeric and Section_No which is text.

I am having another error..

I can read values from a database but I cannot update nor insert

The error I get is

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
/TaraUltimo/VerifyUser.asp, line 26

And my update statement is (line 26)
sSQL = "UPDATE UserInfo SET passwd = 'something' WHERE UserID = 'neeraj'"
oConn.Execute(sSQL)

All the feilds in the DB correspond with the ones in the statement. I have also checked file permissions. Sigh..

The DB is not in my webroot directory though. Does it matter?? since I can read



Edited by - neerajdeo on 29 April 2002 09:57:43
Go to Top of Page

neerajdeo
Starting Member

USA
33 Posts

Posted - 29 April 2002 :  09:42:49  Show Profile  Visit neerajdeo's Homepage  Send neerajdeo a Yahoo! Message
Gremlin thanx I think that should do it. Can you also help with my update question posted earlier

Go to Top of Page

ruirib
Snitz Forums Admin

Portugal
26364 Posts

Posted - 29 April 2002 :  10:16:38  Show Profile  Send ruirib a Yahoo! Message
quote:


And my update statement is (line 26)
sSQL = "UPDATE UserInfo SET passwd = 'something' WHERE UserID = 'neeraj'"
oConn.Execute(sSQL)

All the feilds in the DB correspond with the ones in the statement. I have also checked file permissions. Sigh..

The DB is not in my webroot directory though. Does it matter?? since I can read


Try using a OLEDB driver to connect to the database. It worked for someone who had a situation just like yours...

-------------------------------------------------
Installation Guide | Do's and Dont's | MODs
Go to Top of Page

davemaxwell
Access 2000 Support Moderator

USA
3020 Posts

Posted - 29 April 2002 :  10:55:04  Show Profile  Visit davemaxwell's Homepage  Send davemaxwell an AOL message  Send davemaxwell an ICQ Message  Send davemaxwell a Yahoo! Message
I think UserID is a reserved word (can't remember if it's userid or user). Try surrounding the userid with brackets and see if that helps.

Dave Maxwell
--------------
Proud to be a "World Class" Knucklehead
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 29 April 2002 :  10:55:27  Show Profile  Visit Gremlin's Homepage
Defaintely try Drivers like Ruirib suggested, I can't personally see anything wrong with the piece of code your executing for the insert (assuming oConn has been previously assigned and opened correctly)

www.daoc-halo.com
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 29 April 2002 :  10:56:20  Show Profile  Visit Gremlin's Homepage
I posted a good link to Reserved words a few days back (might have been the person that had the same problem actually) .. I'll see if I can fish it up

www.daoc-halo.com

EDIT: Found the Link http://support.microsoft.com/default.aspx?scid=kb;en-us;Q209187

Edited by - Gremlin on 29 April 2002 10:58:24
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 29 April 2002 :  11:21:11  Show Profile
A few things cause "too few parameters". The usual reason is a mismatch of a column name between the sql statement and the database. Another reason can be a mismatch of datatypes between the sql statement and the database.


======
Doug G
======
Go to Top of Page

neerajdeo
Starting Member

USA
33 Posts

Posted - 02 May 2002 :  16:46:47  Show Profile  Visit neerajdeo's Homepage  Send neerajdeo a Yahoo! Message
Thanx guys I think that solved the problem

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.24 seconds. Powered By: Snitz Forums 2000 Version 3.4.07