...

View Full Version : Help with these queries



danjapro
12-08-2004, 06:21 PM
his is written for a SQL Server, but I am tryign to use the application with Access databse. But the query are slighlty different. It keeps giving me a data mis-match error.

Here is the current sql stament how do I re-write it for Access. I keep getting an error at conn.execute.(sql)

sql = "insert into [plan] (name, price, [desc], feature_post_profile, feature_view_profile, feature_upload_photo, feature_upload_video, feature_upload_audio, feature_quick_search, feature_detailed_search, feature_save_search, feature_add_favorites, feature_send_messages, feature_receive_messages, feature_chat, feature_more_photo, paypal, length) values ('" & name & "', " & price & ", '" & desc & "', '" & feature_post_profile & "', '" & feature_view_profile & "', '" & feature_upload_photo & "', '" & feature_upload_video & "', '" & feature_upload_audio & "', '" & feature_quick_search & "', '" & feature_detailed_search & "', '" & feature_save_search & "', '" & feature_add_favorites & "', '" & feature_send_messages & "', '" & feature_receive_messages & "', '" & feature_chat & "', '" & feature_more_photo & "', '" & paypal & "', '" & length & "')"

conn.execute(sql)
end function

function ModifyPlan(plan_id, name, price, desc, feature_post_profile, feature_view_profile, feature_upload_photo, feature_upload_video, feature_upload_audio, feature_quick_search, feature_detailed_search, feature_save_search, feature_add_favorites, feature_send_messages, feature_receive_messages, feature_chat, feature_more_photo, paypal, length)

sql = "update [plan] set name='" & name & "', price=" & price & ", [desc]='" & desc & "', feature_post_profile='" & feature_post_profile & "', feature_view_profile='" & feature_view_profile & "', feature_upload_photo='" & feature_upload_photo & "', feature_upload_video='" & feature_upload_video & "', feature_upload_audio='" & feature_upload_audio & "', feature_quick_search='" & feature_quick_search & "', feature_detailed_search='" & feature_detailed_search & "', feature_save_search='" & feature_save_search & "', feature_add_favorites='" & feature_add_favorites & "', feature_send_messages='" & feature_send_messages & "', feature_receive_messages='" & feature_receive_messages & "', feature_chat='" & feature_chat & "', feature_more_photo='" & feature_more_photo & "', paypal='" & paypal & "', length='" & length & "' where plan_id=" & plan_id

conn.execute(sql)

fractalvibes
12-08-2004, 06:46 PM
instead of executing the sql, try doing a response.write sql
and see what you actually have.....format it so that it is readable and check to be sure all expected values are there....
then cut and paste and try to run the sql directly in Access.


fv

danjapro
12-08-2004, 07:08 PM
I did that and this is the error I keep getting.

Microsoft JET Database Engine (0x80040E07)
Data type mismatch in criteria expression.
/ashanti/include/plan.asp, line 13

raf
12-08-2004, 09:42 PM
like this


sql = "insert into [plan] (name, price, [desc], feature_post_profile, feature_view_profile, feature_upload_photo, feature_upload_video, feature_upload_audio, feature_quick_search, feature_detailed_search, feature_save_search, feature_add_favorites, feature_send_messages, feature_receive_messages, feature_chat, feature_more_photo, paypal, length) values ('" & name & "', " & price & ", '" & desc & "', '" & feature_post_profile & "', '" & feature_view_profile & "', '" & feature_upload_photo & "', '" & feature_upload_video & "', '" & feature_upload_audio & "', '" & feature_quick_search & "', '" & feature_detailed_search & "', '" & feature_save_search & "', '" & feature_add_favorites & "', '" & feature_send_messages & "', '" & feature_receive_messages & "', '" & feature_chat & "', '" & feature_more_photo & "', '" & paypal & "', '" & length & "')"
response.write sql
response.end
conn.execute(sql)

fractalvibes
12-08-2004, 10:02 PM
yes, exactly. you probably have a variable you are using in the sql that is not set, quoted when it should not be, or vice-versa.

fv

danjapro
12-09-2004, 04:25 PM
I get a permission denied on a this line in another page.

Line 16 aparnetly it is trying to create text file to log the updates.



vFileName = Server.MapPath("../include")
vFileName = vFileName & "/constants.asp"
'response.write vfilename
'response.end

'CREATE THE FILE
Set objFile = objFSO.CreateTextFile(vFileName)

'BUILD A STRING FOR EACH OF THE NAME/VALUE PAIRS SUBMITED ABOVE

'THIS IS THE FIRST LINE OF OUR FSO FILE. IT MARKS THE FILE AS ASP
'objFile.Writeline "<!--#INCLUDE FILE='DIM_CONST.ASP'-->"
objFile.Writeline vbCRLF&Chr(60)&Chr(37)&vbCRLF



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum