Hi, I'm creating a web form that when users complete it and submit the form, it will insert the user entries as a new 'product' record into a 2k SQL Server. The problem I'm having is the record inserts but the GUID is being inserted as a series of spaces instead of the actual generated GUID. Can anyone help me with this? I've tried a hundred different ways to get this to work but still no luck. Below is the code for the 2 pages. The first page is form.asp which is what the visitor sees and completes. When they click on submit, it sends the user form entries to a page called confirm.asp which inserts the record into the database. The main code is on the confirm.asp page. Any help is very much appreciated. Thanks in advance.
form.asp
------------------------
<title>DataPreserve Administration</title>
<form name="AddProducts" method="Post" action="confirm.asp">
<table width="895">
<tr><td colspan="2" align="center"><font face="Tahoma">
<img border="0" src="DPwebpageheader.JPG" width="770" height="150"></font><p>
<span style="letter-spacing: 4pt"><b>
<font face="Tahoma" size="4" color="#003366">DataPreserve Administration</font></b></span></p>
<p><b><font face="Tahoma" color="#003399">Add a New Product</font></b></p>
<p><i><font face="Tahoma" color="#FF0000" size="2">*items with an asterisk
are mandatory fields</font></i></tr>
<tr>
<td> </td>
<td><font face="Tahoma">
<!--webbot bot="Validation" s-data-type="String" b-allow-letters="TRUE" b-allow-digits="TRUE" b-allow-whitespace="TRUE" s-allow-other-chars="{}-" b-value-required="TRUE" i-minimum-length="36" i-maximum-length="40" --><input type="hidden" name="productIdFrmFld" size="50" maxlength="40"> </font></td>
</tr>
<tr>
<td><font face="Tahoma" size="2"><font color="#FF0000">*</font>Product Name
(i.e. 1-2GB Pro Backup Service):</font></td>
<td><font face="Tahoma">
<!--webbot bot="Validation" s-data-type="String" b-allow-letters="TRUE" b-allow-digits="TRUE" b-allow-whitespace="TRUE" s-allow-other-chars=",.'&-" b-value-required="TRUE" i-minimum-length="3" i-maximum-length="20" --><input type="text" name="name" size="50" maxlength="20"></font></td>
</tr>
<tr><td><font face="Tahoma" size="2">Product Description (i.e. 1-2GB Pro Backup
Service):</font></td>
<td><font face="Tahoma">
<!--webbot bot="Validation" s-data-type="String" b-allow-letters="TRUE" b-allow-digits="TRUE" b-allow-whitespace="TRUE" s-allow-other-chars=",.&-'" i-maximum-length="200" --><input type="text" name="description" size="50" maxlength="200"></font></td></tr>
<tr><td><font face="Tahoma" size="2"><font color="#FF0000">*</font>Price (i.e.
199.99):</font></td>
<td><font face="Tahoma">
<input type="text" name="price" size="50"></font></td></tr>
<tr><td><font face="Tahoma" size="2"><font color="#FF0000">*</font>Billing Cycle
(i.e. 1 for 1st of month or -1 for no pro-rating or setup fees):</font></td>
<td><font face="Tahoma">
<!--webbot bot="Validation" s-data-type="String" b-allow-digits="TRUE" b-value-required="TRUE" i-minimum-length="1" i-maximum-length="2" --><input type="text" name="billingCycle" size="50" maxlength="2" value="1"></font></td></tr>
<tr><td><font face="Tahoma" size="2">Minimum Storage Retention (i.e. 0.00 for
zero storage):</font></td>
<td><font face="Tahoma">
<!--webbot bot="Validation" s-data-type="Number" s-number-separators=",." i-maximum-length="6" --><input type="text" name="minRetention" size="50" maxlength="6"></font></td></tr>
<tr><td><font face="Tahoma" size="2">Maximum Storage Retention (i.e. 2.00 for
2GB of storage):</font></td>
<td><font face="Tahoma">
<!--webbot bot="Validation" s-data-type="Number" s-number-separators=",." i-maximum-length="12" --><input type="text" name="maxRetention" size="50" maxlength="12"></font></td></tr>
<tr><td><font face="Tahoma" size="2">Free Quantity (this should be a 1 or a
zero):</font></td>
<td><font face="Tahoma">
<!--webbot bot="Validation" s-data-type="Integer" s-number-separators="," i-maximum-length="2" --><input type="text" name="freeQuantity" size="50" maxlength="2" value="0"></font></td></tr>
<tr><td><font face="Tahoma" size="2">Inventory Number (i.e. 1234567890):</font></td>
<td><font face="Tahoma">
<!--webbot bot="Validation" s-data-type="Integer" s-number-separators="," i-maximum-length="12" --><input type="text" name="inventoryNumber" size="50" maxlength="12"></font></td></tr>
<tr><td><font face="Tahoma" size="2"><font color="#FF0000">*</font>Quantity
Question? (Y or N)</font></td>
<td><font face="Tahoma">
<!--webbot bot="Validation" s-data-type="String" s-allow-other-chars="Y,N" i-maximum-length="1" --><input type="text" name="doQuantityQuestion" size="50" maxlength="1" value="N"></font></td></tr>
<tr><td><font face="Tahoma" size="2">Minimum Value Quantity (i.e. 1):</font></td>
<td><font face="Tahoma">
<!--webbot bot="Validation" s-data-type="Number" s-number-separators=",." i-maximum-length="4" --><input type="text" name="qtyMinValue" size="50" maxlength="4"></font></td></tr>
<tr><td><font face="Tahoma" size="2">Maximum Value Quantity (i.e. 10):</font></td>
<td><font face="Tahoma">
<!--webbot bot="Validation" s-data-type="Number" s-number-separators=",." i-maximum-length="6" --><input type="text" name="qtyMaxValue" size="50" maxlength="6"></font></td></tr>
<tr><td><font face="Tahoma" size="2">Increment Quantity? (this should be a 1 or
a zero)</font></td>
<td><font face="Tahoma">
<!--webbot bot="Validation" s-data-type="Integer" s-number-separators="," i-maximum-length="2" --><input type="text" name="qtyIncrement" size="50" maxlength="2"></font></td></tr>
<tr><td><font face="Tahoma" size="2"><font color="#FF0000">*</font>Product Group
ID (the default group ID is for remote backup service):</font> </td>
<td><font face="Tahoma">
<!--webbot bot="Validation" s-data-type="String" b-allow-letters="TRUE" b-allow-digits="TRUE" s-allow-other-chars="-" b-value-required="TRUE" i-maximum-length="30" --><input type="text" name="productGroupId" size="50" maxlength="30" value="CA094F64-B67E-4419-BFF7-E18A3762D180"></font></td></tr>
<tr><td><font face="Tahoma" size="2"><font color="#FF0000">*</font>Organization
ID (the default Org ID is for DataPreserve:</font></td>
<td><font face="Tahoma">
<!--webbot bot="Validation" s-data-type="String" b-allow-letters="TRUE" b-allow-digits="TRUE" s-allow-other-chars="-" b-value-required="TRUE" i-minimum-length="30" i-maximum-length="36" --><input type="text" name="organizationId" size="50" maxlength="36" value="10FC00E5-73F8-4D2F-AA06-939C2E16C7F8"></font></td></tr>
<tr><td><font face="Tahoma" size="2"><font color="#FF0000">*</font>Is this a
multiplier? (should be either 1.00 or 0.00)</font></td>
<td><font face="Tahoma">
<!--webbot bot="Validation" s-data-type="Number" s-number-separators=",." i-maximum-length="6" --><input type="text" name="isMultiplier" size="50" maxlength="6" value="0.00"></font></td></tr>
<tr><td><font face="Tahoma" size="2"><font color="#FF0000">*</font>Is this an
overage (i.e. Y or N)?</font></td>
<td><font face="Tahoma">
<!--webbot bot="Validation" s-data-type="String" s-allow-other-chars="N,Y" i-maximum-length="1" --><input type="text" name="isOverage" size="50" maxlength="1" value="N"></font></td></tr>
<tr><td><font face="Tahoma" size="2"><font color="#FF0000">*</font>Is this
product active (i.e. Y or N)?</font></td>
<td><font face="Tahoma">
<!--webbot bot="Validation" s-data-type="String" s-allow-other-chars="N,Y" i-maximum-length="1" --><input type="text" name="isActive" size="50" maxlength="1" value="Y"></font></td></tr>
</table>
<p align="center"><font face="Tahoma">
<input type="submit" name="Submit" value="Add New Product"></font></p>
End of form.asp
------------------------------------------
confirm.asp
-----------------------------------------
<%
Dim cnnSimple ' ADO connection
Dim rstSimple ' ADO recordset
Set cnnSimple = Server.CreateObject("ADODB.Connection")
' DSNLess
Set TypeLib = CreateObject("Scriptlet.TypeLib")
strGUID = TypeLib.Guid
If Len(Request.Form) > 0 Then
cnnSimple.Open "Provider=SQLOLEDB;Data Source=servername;" _
& "Initial Catalog=catalog;User Id=user;Password=password;" _
& "Connect Timeout=15;Network Library=dbmssocn;"
Set rstSimple = cnnSimple.Execute("SET NOCOUNT ON; INSERT INTO dbo.product (ProductId, name, description, price, billingCycle, minRetention, maxRetention, freeQuantity, inventoryNumber, doQuantityQuestion, qtyMinValue, qtyMaxValue, qtyIncrement, productGroupId, organizationId, IsMultiplier, IsOverage, IsActive) VALUES ('" & _
Replace(Request.Form("productIdFrmFld"),strGUID,"''")& "', '" & _
Replace(Request.Form("name"),"'","''") & "', '" & _
Replace(Request.Form("description"),"'","''") & "'," & _
Replace(Request.Form("price"),"'","''")& ", '" & _
Replace(Request.Form("billingCycle"),"'","''")& "', '" & _
Replace(Request.Form("minRetention"),"'","''")& "', '" & _
Replace(Request.Form("maxRetention"),"'","''")& "', '" & _
Replace(Request.Form("freeQuantity"),"'","''")& "', '" & _
Replace(Request.Form("inventoryNumber"),"'","''")& "', '" & _
Replace(Request.Form("doQuantityQuestion"),"'","''")& "', '" & _
Replace(Request.Form("qtyMinValue"),"'","''")& "', '" & _
Replace(Request.Form("qtyMaxValue"),"'","''")& "', '" & _
Replace(Request.Form("qtyIncrement"),"'","''")& "', '" & _
Replace(Request.Form("productGroupId"),"'","''")& "', '" & _
Replace(Request.Form("organizationId"),"'","''")& "', '" & _
Replace(Request.Form("IsMultiplier"),"'","''")& "', '" & _
Replace(Request.Form("IsOverage"),"'","''")& "', '" & _
Replace(Request.Form("IsActive"),"'","''")& "');")
Else reply=msgbox("You must complete the form entirely. Please check your entries and try again",65,"Try Again")
document.write(reply)
document.write("The new product has been added")
set rstSimple = Nothing
rstSimple.Close
set rstSimple = Nothing
End If
%>
<message edited by mhebner on Tuesday, January 20, 2009 4:43 PM>