26. februar 2001 - 11:53Der er
32 kommentarer og 1 løsning
check box
hey there
I have a simple db that that show news on an asp page however I am now trying to also incorperate a tru/false funchion so that only certain news items are published I have now added a new colume to my database called publish and this is a true/false \"checkbox\" Now I wish to on the asp page it self have a db connection only choose the news that are true the connection looked like this before SQLstmt = \"SELECT * FROM news ORDER BY dato;\" now I have changed it to SQLstmp = \"SELECT * FROM news where publish = False ORDER BY dato;\" this is wrong as I found out, this is the first time I am working with a check box so Im a little stuck Any help would be great Guzzie
I dette særtema ser vi på, hvordan cloud og AI bliver fundamentet for virksomhedernes digitale forretning, og hvordan de nye muligheder for automatisering og forretningsværdi kan udnyttes uden at miste overblik, sikkerhed og menneskelig kontrol.
what is the value in your \'publish\' coloumn ? if it says true/false, assure that you spell it the same way ( with upper/lower case ), and try with \'\' around true or false..
this is how the db connection looks now <% Set Conn = Server.CreateObject(\"ADODB.Connection\") Conn.Open \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\" & server.MapPath(\"media.mdb\")
SQLstmp = \"SELECT * FROM news where publish = \"true\" ORDER BY dato;\" Set rs = conn.Execute(SQLstmt)
%>
this is the error I get Microsoft VBScript compilation error \'800a0401\'
Expected end of statement
/mediascope/main_news.asp, line 15
SQLstmp = \"SELECT * FROM news where publish = \"true\" ORDER BY dato;\"
-->kasseper :) I tried the same using 1 instead of true but this didnt work either :( Guzzie
could it be somthing like SQLstmp = \"SELECT * FROM news where publish = value(\"1\") ORDER BY dato;\" I know its wrong but you know what i mean I hope :) guzzie
what type is the coloumn \'publish\' ? is it an number, String ? and you obviously put values into this coloumn...so you know if it contains 0/1, true/false, Y/N or something else ?!
hmmm I get this error now Microsoft OLE DB Provider for ODBC Drivers error \'80040e0c\' Command text was not set for the command object.
/mediascope/main_news.asp, line 16
Still line 16 error here the db connection again <% Set Conn = Server.CreateObject(\"ADODB.Connection\") Conn.Open \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\" & server.MapPath(\"media.mdb\")
SQLstmp = \"SELECT * FROM news where publish = \'Yes\' ORDER BY dato;\" Set rs = conn.Execute(SQLstmt) <--THIS IS LINE 16
hey there again :) nope sorry didnt help :( Now I am thinking what if I just have a colume like publish and it was just a normal text colume where I my self have written yes or no would it not be easier to do ?? Guzzie
I don\'t think its the SQL that causes a problem. You get the error \'Command text was not set for the command object.\' and this implies a problem with either the RecordSet or the Connection object. To check if the conection or recordset actually is working, just try with a simple sql:
e.g. SELECT * FROM news
if this goes wrong, there is something wrong with your recordset and/or connection
in line 15 you call your SQL-string \'SQLstmp\', but in line 16 you call it \'SQLstmt\'... U c the diferrence ?? That should solve the problem, don\'t u think ??
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.