navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

Adding a new Record to a existing database

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Adding a new Record to a existing database
Page: [1]
 
mjmtravel

 

Posts: 257
Joined: 7/30/2006
Status: offline

 
Adding a new Record to a existing database - 8/1/2008 20:42:31   
I have a database that I would like to add records to. I used the front page 2003 form with the add to the database feature. I mapped all of my fields, checked my spelling but it will not update my database. It will go to the confirmation page but not update. I have even read to cut the code from html and paste to a new page resetting the options, but that did not work either. Here is my code. Any idea's.
Thanks


<%
' FP_ASP ASP Automatically generated by a Frontpage Component. Do not Edit.

On Error Resume Next
Session("FP_OldCodePage") = Session.CodePage
Session("FP_OldLCID") = Session.LCID
Session.CodePage = 65001
Session.LCID = 1033
Err.Clear

strErrorUrl = ""

If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
If Request.Form("VTI-GROUP") = "0" Then
Err.Clear

Set fp_conn = Server.CreateObject("ADODB.Connection")
FP_DumpError strErrorUrl, "Cannot create connection"

Set fp_rs = Server.CreateObject("ADODB.Recordset")
FP_DumpError strErrorUrl, "Cannot create record set"

fp_conn.Open Application("TimeBilling_ConnectionString")
FP_DumpError strErrorUrl, "Cannot open database"

fp_rs.Open "Equipment", fp_conn, 1, 3, 2 ' adOpenKeySet, adLockOptimistic, adCmdTable
FP_DumpError strErrorUrl, "Cannot open record set"

fp_rs.AddNew
FP_DumpError strErrorUrl, "Cannot add new record set to the database"
Dim arFormFields0(9)
Dim arFormDBFields0(9)
Dim arFormValues0(9)

arFormFields0(0) = "OnSalePrice"
arFormDBFields0(0) = "OnSalePrice"
arFormValues0(0) = Request("OnSalePrice")
arFormFields0(1) = "Model"
arFormDBFields0(1) = "Model"
arFormValues0(1) = Request("Model")
arFormFields0(2) = "SerialNumber"
arFormDBFields0(2) = "SerialNumber"
arFormValues0(2) = Request("SerialNumber")
arFormFields0(3) = "PurchasePrice"
arFormDBFields0(3) = "PurchasePrice"
arFormValues0(3) = Request("PurchasePrice")
arFormFields0(4) = "Capacity"
arFormDBFields0(4) = "Capacity"
arFormValues0(4) = Request("Capacity")
arFormFields0(5) = "Photo"
arFormDBFields0(5) = "Photo"
arFormValues0(5) = Request("Photo")
arFormFields0(6) = "Make"
arFormDBFields0(6) = "Make"
arFormValues0(6) = Request("Make")
arFormFields0(7) = "Category"
arFormDBFields0(7) = "Category"
arFormValues0(7) = Request("Category")
arFormFields0(8) = "Description"
arFormDBFields0(8) = "Description"
arFormValues0(8) = Request("Description")

FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0


fp_rs.Update
FP_DumpError strErrorUrl, "Cannot update the database"

fp_rs.Close
fp_conn.Close

Session("FP_SavedFields")=arFormFields0
Session("FP_SavedValues")=arFormValues0
Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")
Response.Redirect "equipment.asp"

End If
End If

Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")

%>
<%
If Session("UserName")&"" = "" Then
Response.redirect "/customerlogin.asp?Redirect=" &Request.Servervariables("URL")
End if
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<meta http-equiv="Content-Language" content="en-us">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled</title>
<link href="style.css" rel="stylesheet" type="text/css">


</head>

<body >
<table cellpadding="0" cellspacing="0" border="0" align="center" >
<tr>
<td valign="top" width="766" height="731">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" width="766" height="239" style="background:URL(images/header.jpg); background-repeat:no-repeat "><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"
width="766" height="239">
<param name="movie" value="flash/header.swf">
<param name="quality" value="high">
<param name="menu" value="false">
</object>
<!--[if !IE]> <!-->
<object data="flash/header.swf"
width="766" height="262" type="application/x-shockwave-flash">
<param name="quality" value="high">
<param name="menu" value="false">
<param name="pluginurl" value="http://www.macromedia.com/go/getflashplayer">
FAIL (the browser should render some flash content, not this).
</object>
<!--> <![endif]-->
</object></td>
</tr>
<tr>
<td valign="top" width="766" height="422" style="background-color:#FFFFFF ">
<table border="0" width="99%" id="table1" style="border-collapse: collapse" height="413">
<tr>
<td colspan="2" height="52">
 </td>
</tr>
<tr>
<td width="1%" valign="top">
 </td>
<td width="98%" valign="top">
<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveDatabase" SuggestedExt="asp" S-DataConnection="TimeBilling" S-RecordSource="Equipment" U-Database-URL="fpdb/TimeBilling.MDB" U-Confirmation-Url="equipment.asp" S-Form-Fields="OnSalePrice Model SerialNumber PurchasePrice Capacity Photo Make Category Description" S-Form-DBFields="OnSalePrice Model SerialNumber PurchasePrice Capacity Photo Make Category Description" U-ASP-Include-Url="_fpclass/fpdbform.inc" startspan --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--#include file="_fpclass/fpdbform.inc"--><!--webbot bot="SaveDatabase" i-checksum="40548" endspan -->
<table border="1" width="100%" id="table2">
<tr>
<td>Photo</td>
<td width="589">
<input type="text" name="Photo" size="25" tabindex="1"></td>
</tr>
<tr>
<td>Category</td>
<td width="589">
<select size="1" name="Category" tabindex="2">
<option selected>--Select Equipment--
</option>
<option>Propane Forklifts</option>
<option>Electric Forklifts</option>
<option>Pallet Jacks</option>
<option>Machinery</option>
<option>Forklift Accessories</option>
<option>Warehouse Equip</option>
<option>Dock Equipment</option>
<option>Push Around Lifts</option>
</select></td>
</tr>
<tr>
<td>Make</td>
<td width="589">
<input type="text" name="Make" size="25" tabindex="3"></td>
</tr>
<tr>
<td>Model</td>
<td width="589">
<input type="text" name="Model" size="25" tabindex="4"></td>
</tr>
<tr>
<td>Capacity</td>
<td width="589">
<input type="text" name="Capacity" size="25" tabindex="5"></td>
</tr>
<tr>
<td>Serial Number</td>
<td width="589">
<input type="text" name="SerialNumber" size="25" tabindex="6"></td>
</tr>
<tr>
<td>Description</td>
<td width="589">
<textarea rows="2" name="Description" cols="20" tabindex="7"></textarea></td>
</tr>
<tr>
<td>Purchase Price</td>
<td width="589">
<input type="text" name="PurchasePrice" size="25" tabindex="8"></td>
</tr>
<tr>
<td>On Sale Price</td>
<td width="589">
<input type="text" name="OnSalePrice" size="25" tabindex="9"></td>
</tr>
</table>
<p>
<input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>
</td>
</tr>
</table> </td>
</tr>
</table>
</body>
</html>
pd_it_guy

 

Posts: 191
Joined: 3/4/2008
Status: offline

 
RE: Adding a new Record to a existing database - 8/2/2008 10:56:47   
Some basic questions to start the solution process

-Has it ever worked. Is this a brand new db that has never had a record successfully added, or is it a just a new form that won't work.

-if you went to a blank page and added a DRW, does the db connection come up? Does it get a green check when verified

-can you by whatever means browse or otherwise retrieve any records from your db

-Can you go to fpdb folder and open the .mdb directly to make sure the form fields agree (name, data type) with what your form is posting

(in reply to mjmtravel)
mjmtravel

 

Posts: 257
Joined: 7/30/2006
Status: offline

 
RE: Adding a new Record to a existing database - 8/2/2008 15:14:12   
Its not a new database, just a new form trying to add a new record to it. I do have a drw that searches results of the database that works fine on another page. I want to add new records that will eventually show up in the drw search I'm doing.

The connection is good and verified. All of my fields are text except two ID which are numbers and seem to match. I have double checked the spelling also.

This is the fp form updating a database I'm trying to use not the regular drw results type if that matters.

(in reply to pd_it_guy)
pd_it_guy

 

Posts: 191
Joined: 3/4/2008
Status: offline

 
RE: Adding a new Record to a existing database - 8/2/2008 17:36:34   
Ok- thanks- that explains a lot.

Since you can look at a drw, but not edit it, the only option that I see is going back into the form options wizard. If the form has changed any, be sure to ask it to update the database connection so the code knows what fields it will encounter as it tries to do a write. If there are multiple databases make sure the form is pointing to the right table in the db.

Other than that, it looks like you've pretty much covered the bases.

See if anyone else has any ideas. Past that, I would strongly recommend you put your code on <the diet> at least for this form use a straight SQL INSERT INTO. It cuts the code down to less than 1/10 (or less) the size of a DRW, speeds up page loads, and does essentially the same thing, only this way, you get to control it. That has saved me many, many hours of working in the tiny little drw window, always wondering what The Wizard was going to do to my page. Very simple to do, and there are plenty of references as to how.

(in reply to mjmtravel)
mjmtravel

 

Posts: 257
Joined: 7/30/2006
Status: offline

 
RE: Adding a new Record to a existing database - 8/3/2008 9:01:56   
What is the simplist way to add a new record to a database? Do I have to use the Edit, Update pages, since I cannot get the form update to work? I only have about 10 fields to add to a new record. Should the code look something like this.
fp_sQry="INSERT INTO * Equipment WHERE (CategoryID = ::CategoryID::)"


Is there a tutorial that explains it on the forum?

(in reply to pd_it_guy)
pd_it_guy

 

Posts: 191
Joined: 3/4/2008
Status: offline

 
RE: Adding a new Record to a existing database - 8/3/2008 12:04:09   
That looks about right, if equipment ID is numeric.

What we do is get a basic db query we can use and re-use for all our db operations- INSERT INTO, UPDATE, and DELETE. Go to a blank page, call for database results for say, 1 or 2 columns as a list. Make sure it works. Then go to the code and delete EVERYTHING in gray text except the 3 include files. You most definitely need those or it wont work. There should be one just before the SQL block, one right before the results are posted, and the last one just after the last of the results. That should take the page of gray code and get it down to about 12-15 lines and it will end up doing the very same thing as before. This is essentially the Spooky diet. Now, you can edit it anyway you want. If you run the code with an insert into and run it, it will add a record. Or you can use it for select. The reason it is so useful is because it's so short you can drop it in your page anywhere a db read or write is required, and you can actually see exactly what it's doing.

What we next do is make a form, to do whatever we want. Using the right variable names makes it easy. In form PROPERTIES, we select a custom ISAPI. CGU, script etc and put the name of another blank page in. The script you just boiled down POST's (and redirects) to that other page. The boiled down db connection goes on that second page as well. For the write, the variables that were just POST'ed by your form go into the SQL statement. You also can use some of those variables to make the write page be a very customized confirm page. Of course you can always redirect this new page yet again onto somewehre else after the write. We usually make a simple confirmation, and give the user a couple of ways out.

There should be plenty of examples of INSERT INTO's, (if not here w3 schools) and you can fill all the columns, or just a few. If we wanted to set up a form to delete records, we would just copy out that block of code only this time set the SQL to DELETE. Or, SELECT.

This make sense?

(in reply to mjmtravel)
pd_it_guy

 

Posts: 191
Joined: 3/4/2008
Status: offline

 
RE: Adding a new Record to a existing database - 8/3/2008 12:13:11   
Ummmm.... Better check your syntax.

You INSERT INTO a database table. No asterick required.

Sort of goes like " INSERT INTO equipment VALUES ('::type_of_truck::', ::equipment_ID::, '::whatever_else_you_have::')

This is, if you are filling out the entire row. If you want a record that only does part of the row you have to specify sequentially what variable goes to what column, thus:

INSERT INTO table_name (column1, column2,...)
VALUES (value1, value2,....)

We usually call them all out so we can confirm everyone is accounted for.

That make sense?


(in reply to pd_it_guy)
mjmtravel

 

Posts: 257
Joined: 7/30/2006
Status: offline

 
RE: Adding a new Record to a existing database - 8/4/2008 19:52:32   
Ok, did a new equipment update page with this code as the query.
fp_sQry="INSERT INTO Equipment VALUES '::Photo::', '::Category::',
'::Make::', '::Model::', '::Capacity::', '::SerialNumber::', '::Description::', '::PurchasePrice::', '::OnSalePrice::')

I created a form to go to the above update page using the post method. In the advance section I'm carrying the ID over, <%=FP_FieldVal(fp_rs,"TruckID")%>

I get the 500 internal server error, which is a whole nother problem to see the actual error. My question is what do I do with the auto number field / TruckID? I can reference another category ID in the same table if I have to?

(in reply to pd_it_guy)
pd_it_guy

 

Posts: 191
Joined: 3/4/2008
Status: offline

 
RE: Adding a new Record to a existing database - 8/4/2008 21:15:06   
Ok- looking pretty good so far.

The internal server error can come from a whole lot of reasons. There is a lot of documentation on the site as to exactly why that happens, and how to run it down... however, in this case I would start by making sure whoever hits the form submit button has permission to write to the db.

If you are carrying a number over from the form, it would have to be placed in a conventional column, appropriate to its data type. Auto number fields Uusually the very first column) are left alone. Which is to say any record addition gets its own unique number in the auto number field. You have it right.

I would also recommend as we get this tuned up you call all the column headings first, then show the VALUES (in the same order) so there is no mistake, and the variables are written in exactly as you want them to be.

(in reply to mjmtravel)
pd_it_guy

 

Posts: 191
Joined: 3/4/2008
Status: offline

 
RE: Adding a new Record to a existing database - 8/4/2008 21:22:08   
And... it looks like a missing opening paren right after VALUES. Both the column name callouts and the values to go in them get parenthesized.

And the closing quote afte OnSalePrice::')"

And if there is an actual line break from Category to Make it needs to be properly broken with a " _ at line end,

and

& " at beginning of the next.


(in reply to pd_it_guy)
mjmtravel

 

Posts: 257
Joined: 7/30/2006
Status: offline

 
RE: Adding a new Record to a existing database - 8/5/2008 20:31:34   
Ok, tried that and here is my code now.

fp_sQry="INSERT INTO Equipment (Photo, Category, Make, Model, Capacity, SerialNumber, Description, PurchasePrice, OnSalePrice) VALUES ('::Photo::', '::Category::', '::Make::', '::Model::', '::Capacity::', '::SerialNumber::', '::Description::', '::PurchasePrice::', '::OnSalePrice::')"

No line brakes in the code its just showing that way. I still get the internal server error after this with no luck. Cannot fix the internal server error to get the actual error sorry.

Not sure where else to go from here and its taking me to long t fix. I also tried the basic form in front page, sending results to the database and cannot make it work either. Not even with 2 lines. I have consulted my host with trying to find the exact error and they give me a list of stuff to put in my public html file which is all greek to me.

(in reply to pd_it_guy)
pd_it_guy

 

Posts: 191
Joined: 3/4/2008
Status: offline

 
RE: Adding a new Record to a existing database - 8/5/2008 20:42:45   
Ok stand by a sec while I study this...

(in reply to mjmtravel)
pd_it_guy

 

Posts: 191
Joined: 3/4/2008
Status: offline

 
RE: Adding a new Record to a existing database - 8/5/2008 21:14:25   
1. The SQL looks great. If all the variables coming over from the form are text, and the names you list first are the exact names of the columns in the db, and the ones in the :: brackets are the ones coming from the form, and each matches sequentially (I count a 9:9 matchup) it has to work.

2. We are assuming that surrounding this segment of code are the other parts of the essentialized db connection routine, including the 3 include files. Sort of a combination of about 15 or so lines of red and gray text, somewhere in the head of the second page that the form feeds to. Is that the case?

3. Your form calls this second page as a custom ISAPI/CGI script (we sort of assume that is true)

4. You can physically get to your .mdb file, open it and look at it. The columns in the .mdb match the SQL That part all OK?

5. If all so far true, then, if you, or a web user can do a query, you should also be able to do a write. However, there is one more piece with a write, and that is, does the user have permission. The 500 error can be for a lot of things, but among them is not having write permission- the IUSR(machine name) or IWAM users have to be there. If the public gets to add records via the web, then IUSR has to have write permission. is that the kind of setup you have in mind.

or-

If its only you adding records, and only do it now and then, you don't need to do any of this- you can go right to your .mdb, open it, and add them directly. is that more like what you want?

Can you share with us what your web provider suggested you do and perhaps we can make some more sense of it.

We are also assuming you have turned OFF the friendly error messages in your browser setup to get whatever information you can.

These are not trivial operations and make a bit of time to run down exactly what is not working here. But you have to clear that 500 error first.


< Message edited by pd_it_guy -- 8/5/2008 21:27:01 >

(in reply to pd_it_guy)
mjmtravel

 

Posts: 257
Joined: 7/30/2006
Status: offline

 
RE: Adding a new Record to a existing database - 8/5/2008 21:43:38   
You are correct, everything else in the form is correct to the best of my knowledge. I have removed the friendly errors check box, changed my fp class files to spooky's older version and debug is set to true also. I have fought this error every since I purchased front page 2003, only a few of my sites give me the actual correct error. I have done the same set up with all of them.

I can post the entire form code and drw update page if that will help, but it will have to be tomorrow.

Thanks for all your help. I submitted a ticket back to my host also for a clearer version of what they wanted me to do also.

(in reply to pd_it_guy)
pd_it_guy

 

Posts: 191
Joined: 3/4/2008
Status: offline

 
RE: Adding a new Record to a existing database - 8/5/2008 23:14:29   
All good actions to take. Will await further information. I have this feeling, that once the server error is resolved, your original accessory code for record additions will probably start working on its own again.

(in reply to mjmtravel)
mjmtravel

 

Posts: 257
Joined: 7/30/2006
Status: offline

 
RE: Adding a new Record to a existing database - 8/6/2008 17:44:22   
Ok making some headway now. Talk to my host they said to go into my online control panel and also make sure to uncheck "custom error documents". That gave me my actual error and fixed that in a Jiffy. If I would have only known that!!

So now my edit form loads fine, I click update and I get this error now.
Unable to find operator in query string. Query string currently is INSERT INTO Equipment (Photo, Category, Make, Model, Capacity, SerialNumber, Description, PurchasePrice, OnSalePrice) VALUES ('::Photo::', '::Category::', '::Make::', '::Model::', '::Capacity::', '::SerialNumber::', '::Description::', '::PurchasePrice::', '::OnSalePrice::')

My question is now, do I have to have all of the table fields listed in the query even though I'm not using them?
I know now to leave out the autonumber ID field, but does the query need to see all fields to do the update?

(in reply to pd_it_guy)
pd_it_guy

 

Posts: 191
Joined: 3/4/2008
Status: offline

 
RE: Adding a new Record to a existing database - 8/6/2008 20:00:13   
Congrats on clearing your '500' server error.

Every field you want to update needs to be listed. If you only list 2, then you only need to provide it 2 variables. They go sequentially. No requirement that you feed a new record every single column. Ones not used are just blank.

I am really suspicious of your 'missing operator' error. That sounds like it should be very easy to find. Can you grab the entire db connection block from the page the form feeds to, and post it. This, once again, should be just gray and red in your HTML editor.

Include files are gray and vb script of course is red. Should be about 15 or so lines. And just post it. Expecting to see the 3 gray include files and about a dozen vb script lines pointing to the table, some defaults, and in there, your actual SQL verbiage that we have pretty much decided has to work. The block opens the db and feeds it the string for action. Since we are not returning any records, the last 2 include files are right together, and unless you are doing some confirmations, the entire page for now will be blank, in the normal editor. You can add the other stuff later.

On my way home and will check back. Would like to see you resolve this ASAP.

< Message edited by pd_it_guy -- 8/6/2008 20:06:01 >

(in reply to mjmtravel)
mjmtravel

 

Posts: 257
Joined: 7/30/2006
Status: offline

 
RE: Adding a new Record to a existing database - 8/6/2008 20:08:34   
Here it is. Sure looks good to me, but I'm sure some " is out of place. I hope.


<table border="0" width="93%" id="table1" style="border-collapse: collapse">
<tr>
<td>
<!--#include file="_fpclass/fpdblib.inc"-->
<% if 0 then %>
<SCRIPT Language="JavaScript">
document.write("<div style='background: yellow; color: black;'>The Database Results component on this page is unable to display database content. The page must have a filename ending in '.asp', and the web must be hosted on a server that supports Active Server Pages.</div>");
</SCRIPT>
<% end if %>
<%
fp_sQry="INSERT INTO Equipment (Photo, Category, Make, Model, Capacity, SerialNumber, Description, PurchasePrice, OnSalePrice) VALUES ('::Photo::', '::Category::', '::Make::', '::Model::', '::Capacity::', '::SerialNumber::', '::Description::', '::PurchasePrice::', '::OnSalePrice::')"
fp_sDefault="Category"
fp_sNoRecords="Your Equipment Has Been Updated, Please wait a moment!"
fp_sDataConn="TimeBilling"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&TruckID=3&Photo=202&Category=202&Make=202&Model=202&Capacity=202&SerialNumber=202&Description=202&PurchasePrice=202&OnSalePrice=202&CategoryID=3&Edit=202&"
fp_iDisplayCols=12
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="_fpclass/fpdbrgn1.inc"-->
<table BORDER="1" width="406">
<tr>
<td width="110"><b>Photo:</b></td>
<td>
<%=FP_FieldVal(fp_rs,"Photo")%></td>
</tr>
<tr>
<td width="110"><b>Category:</b></td>
<td>
<%=FP_FieldVal(fp_rs,"Category")%></td>
</tr>
<tr>
<td width="110"><b>Make:</b></td>
<td>
<%=FP_FieldVal(fp_rs,"Make")%></td>
</tr>
<tr>
<td width="110"><b>Model:</b></td>
<td>
<%=FP_FieldVal(fp_rs,"Model")%></td>
</tr>
<tr>
<td width="110"><b>Capacity:</b></td>
<td>
<%=FP_FieldVal(fp_rs,"Capacity")%></td>
</tr>
<tr>
<td width="110"><b>Serial Number:</b></td>
<td>
<%=FP_FieldVal(fp_rs,"SerialNumber")%></td>
</tr>
<tr>
<td width="110"><b>Description:</b></td>
<td>
<%=FP_FieldVal(fp_rs,"Description")%></td>
</tr>
<tr>
<td width="110"><b>Purchase Price:</b></td>
<td>
<%=FP_FieldVal(fp_rs,"PurchasePrice")%></td>
</tr>
<tr>
<td width="110"><b>On Sale Price:</b></td>
<td>
<%=FP_FieldVal(fp_rs,"OnSalePrice")%></td>
</tr>
</table>
<hr>
<!--#include file="_fpclass/fpdbrgn2.inc"-->
<p> </p>
<p>
 </p>
<p> </td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td valign="top" width="766" height="70" style="background:URL(images/footer.gif); background-repeat:no-repeat ">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" width="353" height="70">
<div style="padding-left:57px; padding-top:18px " class="main"> <strong>Copyright © 2005, Plumbing Company <br>
<a href="equipmentadd.asp" class="main">Privacy policy</a> </strong>
</div>
</td>
<td valign="top" width="413" height="70">
<div style="padding-left:0px; padding-top:17px; " class="text"><a href="index.html" class="text"><strong>Home</strong></a><a href="AboutUs.html" class="text"><strong style="margin-left:40px ">About Us</strong></a><a href="services.html" class="text"><strong style="margin-left:34px ">Services</strong></a><a href="customerlogin.asp" class="text"><strong style="margin-left:23px ">Tips & Hints</strong></a><a href="contactus.html" class="text"><strong style="margin-left:19px ">Contacts</strong></a></div>
</td>
</tr>
</table>
</td>
</tr>
</table>

(in reply to pd_it_guy)
pd_it_guy

 

Posts: 191
Joined: 3/4/2008
Status: offline

 
RE: Adding a new Record to a existing database - 8/6/2008 21:02:29   
I'll tell you what see.

First and easiest, but may be nothing:

Move this guy, <!--#include file="_fpclass/fpdblib.inc"-->

Just before the opening vb script <% before the block. There is a java script block intervening. The if then and Java does not need it.

...
<!--#include file="_fpclass/fpdblib.inc"-->
<%
fp_sQry="INSERT INTO Equipment (Photo, Category, Make, Model, Capacity, SerialNumber, Description, PurchasePrice, OnSalePrice) VALUES ('::Photo::', '::Category::', '::Make::', '::Model::', '::Capacity::', ...

Second and harder, essentialize the page so the operation to write is one contiguous block. This is all that is required to do a write. We are not re-querying, or selecting anything. If you want to play those values back to the page viewer, they can be fetched once again by Request.Form("SerialNumber") and so forth. Thus, you WRITE the record. Done. If you want to requery to show the new database contents you can do that as well. Usually all they want to know is that the record made it.


<!--#include file="_fpclass/fpdblib.inc"-->
<%
fp_sQry="INSERT INTO Equipment (Photo, Category, Make, Model, Capacity, SerialNumber, Description, PurchasePrice, OnSalePrice) VALUES ('::Photo::', '::Category::', '::Make::', '::Model::', '::Capacity::', '::SerialNumber::', '::Description::', '::PurchasePrice::', '::OnSalePrice::')"
fp_sDefault="Category"
fp_sNoRecords="Your Equipment Has Been Updated, Please wait a moment!"
fp_sDataConn="TimeBilling"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_sColTypes="&TruckID=3&Photo=202&Category=202&Make=202&Model=202&Capacity=202&SerialNumber=202&Description=202&PurchasePrice=202&OnSalePrice=202&CategoryID=3&Edit=202&"
fp_iDisplayCols=12
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="_fpclass/fpdbrgn1.inc"-->
<!--#include file="_fpclass/fpdbrgn2.inc"-->


I am sort of out of ideas at this point.


(in reply to mjmtravel)
mjmtravel

 

Posts: 257
Joined: 7/30/2006
Status: offline

 
RE: Adding a new Record to a existing database - 8/7/2008 19:36:37   
Well I made those last changes and I still receive the same error. Thanks for your help pd_it_guy. I will post the answer if I come up with it or find it somewhere.

If anyone else has any ideas please let me know.

Thanks again.

(in reply to pd_it_guy)
mjmtravel

 

Posts: 257
Joined: 7/30/2006
Status: offline

 
RE: Adding a new Record to a existing database - 8/8/2008 20:39:14   
Just thought I would post an update. I didn't figure out why the page was loading with errors above, but I did figure out it had to do with some flash coding I used as the header for the page. I removed the flash portion, created a simple post to database form and it worked fine.

Not in the mood to figure that one out at this point so removed the flash so my client could continue to update. Its funny that it would post the results from a drw but not do the update???

Thanks again for your help.

(in reply to mjmtravel)
pd_it_guy

 

Posts: 191
Joined: 3/4/2008
Status: offline

 
RE: Adding a new Record to a existing database - 8/9/2008 10:25:49   
So.... if I read right, we are now properly posting and updating, albeit without flash. That is excellent news. I can't tell you much about flash, either, and that was why we suggested earlier to keep the INSERT INTO operation into a tight, little self- contained block, all on its own, and not intersperse it in and around other things. And as a troubleshooting idea to remove everything except the one thing you HAVE to do, get it going, and add things back one at a time and see what breaks it. Thanks for the update.

(in reply to mjmtravel)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> Adding a new Record to a existing database
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts