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.
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
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
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)
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.