Jump to content

what's wrong with this simple code ?


tjodalv

Recommended Posts

I have database table tblImg that have fields:idnidthumbnailpictureThis is my code that is not working

Set rsImg = Server.CreateObject("ADODB.Recordset")strSQL = "SELECT MIN(id) FROM tblImg WHERE nid = " & myNID & ";"rsImg.Open strSQL, dbConnIf rsImg.EOF = "" Then   imgThumb = "nopic.gif"Else   imgID = rsImg(0)   Set rsMyImg = Server.CreateObject("ADODB.Recordset")   strSQL = "SELECT * FROM tblImg WHERE id = " & imgID & ";"   rsMyImg.Open strSQL, dbConn							   If NOT rsMyImg.EOF Then	  imgThumb = rsMyImg("thumbnail")   End ifEnd ifSet rsImg = NothingSet rsMyImg = Nothing

I get an error:Microsoft JET Database Engine (0x80040E14)Syntax error (missing operator) in query expression 'id ='.Line:strSQL = "SELECT * FROM tblImg WHERE id = " & imgID & ";"<edit>I've found a problem. The problem was at the line:If rsImg.EOF = "" ThenI've triedIf IsNull(rsImg(0)) Thenand that is working.</edit>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...