This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Dreamweaver > June 2004 > Update Command Problem ! Help !
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Update Command Problem ! Help !
|
|
| Joe T C 2004-06-11, 4:14 am |
| Hello,
I have a form thats loading up and all the text fields are being loaded with
data from the tables fine. I have my update command running off my submit
button.. Everything is working pretty good. One big problem. I have a alot of
fields in the tables that are numberic, not required, and only has a few
records that has data in them so far. The form is loading up fine and if I go
thur and fill in every text box on the form with a number ( all the numberic
fields in table) and hit save, it saves everything fine. If I leave just one
blank and hit save i get a error saying "Data type mismatch in criteria
expression." Problem is cant really set a default on those numberic fields in
the database. I need it to send a null or leave it blank if its not filled in
on the form or if you delete the number on the form and hit save.. I can make a
query in access and when its run it will pass a blank or null into that field
ok so thinking I just have something wrong in the code. Any help would be great
!!! Code is below:
<%
if(Request("yr_built") <> "") then update_general__var_yr_built =
Request("yr_built")
if(Request("hidden_courseid") <> "") then update_general__var_courseid =
Request("hidden_courseid")
%>
<% If Request("Submit_form") <> "" Then %>
<%
set update_general = Server.CreateObject("ADODB.Command")
update_general.ActiveConnection = MM_admin_db_STRING
update_general.CommandText = "UPDATE tblGeneralInfo SET YrBuilt = '" +
Replace(update_general__var_yr_built, "'", "''") + "' WHERE CourseID = '" +
Replace(update_general__var_courseid, "'", "''") + " ' "
update_general.CommandType = 1
update_general.CommandTimeout = 0
update_general.Prepared = true
update_general.Execute()
%>
<% End If %>
Thanks
Joe
| |
| Murray *TMM* 2004-06-11, 12:14 pm |
| Why not use Jaro's CheckForm extension to do this check client side before
the form is submitted?
--
Murray --- ICQ 71997575
Team Macromedia Volunteer for Dreamweaver MX
(If you *MUST* email me, don't LAUGH when you do so!)
==================
news://forums.macromedia.com/macromedia.dreamweaver - THE BEST WAY TO GET
ANSWERS
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================
"Joe T C" <webforumsuser@macromedia.com> wrote in message
news:cabgk3$jm7$1@forums.macromedia.com...
> Hello,
>
> I have a form thats loading up and all the text fields are being loaded
with
> data from the tables fine. I have my update command running off my submit
> button.. Everything is working pretty good. One big problem. I have a alot
of
> fields in the tables that are numberic, not required, and only has a few
> records that has data in them so far. The form is loading up fine and if I
go
> thur and fill in every text box on the form with a number ( all the
numberic
> fields in table) and hit save, it saves everything fine. If I leave just
one
> blank and hit save i get a error saying "Data type mismatch in criteria
> expression." Problem is cant really set a default on those numberic fields
in
> the database. I need it to send a null or leave it blank if its not filled
in
> on the form or if you delete the number on the form and hit save.. I can
make a
> query in access and when its run it will pass a blank or null into that
field
> ok so thinking I just have something wrong in the code. Any help would be
great
> !!! Code is below:
>
> <%
> if(Request("yr_built") <> "") then update_general__var_yr_built =
> Request("yr_built")
> if(Request("hidden_courseid") <> "") then update_general__var_courseid =
> Request("hidden_courseid")
> %>
>
> <% If Request("Submit_form") <> "" Then %>
> <%
> set update_general = Server.CreateObject("ADODB.Command")
> update_general.ActiveConnection = MM_admin_db_STRING
> update_general.CommandText = "UPDATE tblGeneralInfo SET YrBuilt = '" +
> Replace(update_general__var_yr_built, "'", "''") + "' WHERE CourseID = '"
+
> Replace(update_general__var_courseid, "'", "''") + " ' "
> update_general.CommandType = 1
> update_general.CommandTimeout = 0
> update_general.Prepared = true
> update_general.Execute()
> %>
> <% End If %>
>
> Thanks
>
> Joe
>
| |
| Joe T C 2004-06-11, 7:15 pm |
| Well I went ahead and downloaded that ext. Thats more of a validation i think.
Only would allow me to say that text box is required or only values from x to
y. Trying to find a way to allow a user to keep that field blank or empty and
then hit the submit button and all the data save to the table..
Thanks
Joe
|
|
|
| | Copyright 2003 - 2009 forum4designers.com Software forum Computer Hardware reviews |
|