27. februar 2001 - 16:35
Der er
29 kommentarer og 1 løsning
Check Box Again Again Part 2
Hey There I have an asp page that updates an insert in my database however I am getting this error Microsoft OLE DB Provider for ODBC Drivers error \'80040e07\' [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression. /mediascope/admin/edit_save_news.asp, line 22 my script looks like this <% Set Conn = Server.CreateObject(\"ADODB.Connection\") Conn.Open \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\" & server.MapPath(\"../media.mdb\") SQLstmp = \"UPDATE DISTINCTROW news SET dato = #\" & Now & \"#, news_name = \'\" & request.form(\"news_name\") & \"\', news = \'\" & request.form(\"news\") & \"\', authour = \'\" & request.form(\"authour\") & \"\', email = \'\" & request.form(\"email\") & \"\', publish = \'\" & request.form(\"publish\") & \"\' WHERE Id = \" & Request(\"Id\") Conn.Execute (SQLstmp) conn.Close Set conn = nothing Set SQLstmp = nothing response.redirect (\"main_news.asp\") %> line 22 is this Conn.Execute (SQLstmp) however the last insert in the SQLstmp is a colume called publish and it is a check box, the script works fine if I dont have publish should publish have some sort of \"if blah blah then blah blah\" statement ?? Guzzie
Annonceindlæg tema
Cloud & AI
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.
27. februar 2001 - 16:37
#1
BTW publish is set as True/False Guzzie
27. februar 2001 - 16:39
#2
Tra to make all your fields ind your database to as \"note\" -Anders
27. februar 2001 - 16:42
#3
Try even...
27. februar 2001 - 16:46
#4
my database fields are set to note and text however this cant be the problem as I have used this DB for a while now but only untill today when I inserted the True/False checkbox have I recieved an error Guzzie
27. februar 2001 - 17:08
#5
Guzzie > You have to filter your \'publish\' variable. the value will be \'on\' when you request it...so I suggest: if( request.form(\"publish\") = \"on\" ) then publish = \"Yes\" else publis = \"No\" end if and then you use the variable \'publish\' in the sql /nute
27. februar 2001 - 17:17
#6
hey there nute :)) I am still getting the samn error in this line Conn.Execute (SQLstmp) here the DB connection as it stands now :) <% if( request.form(\"publish\") = \"on\" ) then publish = \"Yes\" else publis = \"No\" end if Set Conn = Server.CreateObject(\"ADODB.Connection\") Conn.Open \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\" & server.MapPath(\"../media.mdb\") SQLstmp = \"UPDATE DISTINCTROW news SET dato = #\" & Now & \"#, news_name = \'\" & request.form(\"news_name\") & \"\', news = \'\" & request.form(\"news\") & \"\', authour = \'\" & request.form(\"authour\") & \"\', email = \'\" & request.form(\"email\") & \"\', publish = \'\" & request.form(\"publish\") & \"\' WHERE Id = \" & Request(\"Id\") Conn.Execute (SQLstmp) conn.Close Set conn = nothing Set SQLstmp = nothing response.redirect (\"main_news.asp\") %> Guzzie
27. februar 2001 - 17:20
#7
try this SQLstmp = \"UPDATE DISTINCTROW news SET dato = #\" & Now & \"#, news_name = \'\" & request.form(\"news_name\") & \"\', news = \'\" & request.form(\"news\") & \"\', authour = \'\" & request.form(\"authour\") & \"\', email = \'\" & request.form(\"email\") & \"\', publish = \'\" & publish & \"\' WHERE Id = \" & Request(\"Id\") Conn.Execute (SQLstmp) /nute
27. februar 2001 - 17:38
#8
Sorry nute it didnt work ;( btw shouln´t if( request.form(\"publish\") = \"on\" ) then publish = \"Yes\" else publish = \"No\" end if be True / Flase ?? dunno myself just thinking out loud :) Guzzie
27. februar 2001 - 17:41
#9
yes it should....:) /nute
27. februar 2001 - 17:49
#10
nope still nothing still the same error Data type mismatch in criteria expression. sniff :( Guzzie
27. februar 2001 - 17:51
#11
leave out the \'\' around --> \" & publish & \" <-- inside your sql
27. februar 2001 - 18:02
#12
hmm strange Damn :( same error :(
27. februar 2001 - 18:03
#13
do a response.write on your sql and send it to me....
27. februar 2001 - 18:04
#14
I was thinking should we not still be requesting publish ??
27. februar 2001 - 18:06
#15
you should keep your code as tou posted it in you posting at 27/02 2001 17:17:57, but replase your SQLstmt with the one I posted at 27/02 2001 17:20:39... /nute
27. februar 2001 - 18:07
#16
response write ?? I dont quite follow a response write after conn.Close Set conn = nothing Set SQLstmp = nothing response.write \"lkfjdlkj\" or in the SQL if you mean in the SQL then Im not quite sure how :( Guzzie
27. februar 2001 - 18:10
#17
like this: <% Set Conn = Server.CreateObject(\"ADODB.Connection\") Conn.Open \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\" & server.MapPath(\"../media.mdb\") SQLstmp = \"UPDATE DISTINCTROW news SET dato = #\" & Now & \"#, news_name = \'\" & request.form(\"news_name\") & \"\', news = \'\" & request.form(\"news\") & \"\', authour = \'\" & request.form(\"authour\") & \"\', email = \'\" & request.form(\"email\") & \"\', publish = \" & publish & \" WHERE Id = \" & Request(\"Id\") response.write SQLstmt /nute
27. februar 2001 - 18:11
#18
k tried it but to no avail
27. februar 2001 - 18:12
#19
SQLstmt ?? SQLstmp ?? :)
27. februar 2001 - 18:12
#20
uups...sorry.... response.write SQLstmp
27. februar 2001 - 18:15
#21
k here the current db connection <% Set Conn = Server.CreateObject(\"ADODB.Connection\") Conn.Open \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\" & server.MapPath(\"../media.mdb\") SQLstmp = \"UPDATE DISTINCTROW news SET dato = #\" & Now & \"#, news_name = \'\" & request.form(\"news_name\") & \"\', news = \'\" & request.form(\"news\") & \"\', authour = \'\" & request.form(\"authour\") & \"\', email = \'\" & request.form(\"email\") & \"\', publish = \" & publish & \" WHERE Id = \" & Request(\"Id\") response.write SQLstmt Conn.Execute (SQLstmp) conn.Close Set conn = nothing Set SQLstmp = nothing response.redirect (\"main_news.asp\") %> And heres the error i get Microsoft OLE DB Provider for ODBC Drivers error \'80040e14\' [Microsoft][ODBC Microsoft Access Driver] Syntax error in UPDATE statement. /mediascope/admin/edit_save_news.asp, line 27 Guzzie
27. februar 2001 - 18:18
#22
yes, I understand...but *how* does your sql look like after you insert the values into it... try leave out Conn.execute(SQLstmp) and just print out your SQLstmp !! ( and post it...)
27. februar 2001 - 18:19
#23
HEY NUTE found out wot was happening heres the final edition and it works :) <% if( request.form(\"publish\") = \"True\" ) then publish = \"True\" else publish = \"False\" end if Set Conn = Server.CreateObject(\"ADODB.Connection\") Conn.Open \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\" & server.MapPath(\"../media.mdb\") SQLstmp = \"UPDATE DISTINCTROW news SET dato = #\" & Now & \"#, news_name = \'\" & request.form(\"news_name\") & \"\', news = \'\" & request.form(\"news\") & \"\', authour = \'\" & request.form(\"authour\") & \"\', email = \'\" & request.form(\"email\") & \"\', publish = \" & publish & \" WHERE Id = \" & Request(\"Id\") response.write SQLstmt Conn.Execute (SQLstmp) conn.Close Set conn = nothing Set SQLstmp = nothing response.redirect (\"main_news.asp\") %> :))))) Guzzie
27. februar 2001 - 18:20
#24
kewl nice team work :)) heres your points and once again ;) thanks for the help Guzzie
27. februar 2001 - 18:21
#25
anytime, Guzzie ;) thanx to you to...
27. februar 2001 - 18:24
#26
k response.write SQLstmt is also not nessacery
27. februar 2001 - 18:24
#27
response.write SQLstmp I mean :) hihi Guzzie
27. februar 2001 - 18:26
#28
nope....thats just for debug....it\'s easier to see if there\'s something wrong in the sql-statement when you see the whole thing, cause looking at it in your code can be pretty confusing...specially when working with larger sql-statements... /nute
27. februar 2001 - 18:58
#29
now Im with Am I right in saying that response.write SQLstmp gives you a kind of more detailed error description ??
27. februar 2001 - 20:04
#30
in a way...yes... you will get an output of the complete sql-statement... you will then be more able to see if you are missing something or have something in excess (e.g. a \' ). you will be able to debug your actions better when you give some kind of outputs on your actions... /nute
Kurser inden for grundlæggende programmering