shocka
04-11-2005, 09:04 AM
Hi I am having problems with my Sql in trying to add to an access Database
I have a horrible feeling it may be in the "" But I have looked and looked and cannot seem to find the issue ( Not that this mesns a lot I am new ) I was wondering if somebody could cast an eye over it and see if they can see the problem.
Thanks In advance
Shocka
<code>
<html>
<head>
</head>
<body>
<%
' Declaring variables
Dim Branch_Number, State, Requested_By, Description, Supplier_Name, List_Price, Invoice_Discount, Price_List_Date, UOM, Supplier_Part_Number, Multiple_Order_Quantity, Minimum_Order_Quantity, Reason, Projected_Sales, Alternative_Code, JDE_Code, Department, Group, Sub_Group, Brand, Style, Colour, Exclusive, Price_Break_QTY, Status, State_Availability, Date, data_source, con, sql_insert
' A Function to check if some field entered by user is empty
Function ChkString(string)
If string = "" Then string = " "
ChkString = Replace(string, "'", "''")
End Function
' Receiving values from Form
Branch_Number = ChkString(Request.Form("Branch_Number"))
State = ChkString(Request.Form("State"))
Requested_By = ChkString(Request.Form("Requested_By"))
Description = ChkString(Request.Form("Description"))
Supplier_Name = ChkString(Request.Form("Supplier_Name"))
List_Price = ChkString(Request.Form("List_Price"))
Invoice_Discount = ChkString(Request.Form("Invoice_Discount"))
Price_List_Date = ChkString(Request.Form("Price_List_Date"))
UOM = ChkString(Request.Form("UOM"))
Supplier_Part_Number = ChkString(Request.Form("Supplier_Part_Number"))
Multiple_Order_Quantity = ChkString(Request.Form("Multiple_Order_Quantity"))
Minimum_Order_Quantity = ChkString(Request.Form("Minimum_Order_Quantity"))
Reason = ChkString(Request.Form("Reason"))
Projected_Sales = ChkString(Request.Form("Projected_Sales"))
Alternative_Code = ChkString(Request.Form("Alternative_Code"))
JDE_Code = ChkString(Request.Form("JDE_Code"))
Department = ChkString(Request.Form("Department"))
Group = ChkString(Request.Form("Group"))
Sub_Group = ChkString(Request.Form("Sub_Group"))
Brand = ChkString(Request.Form("Brand"))
Style = ChkString(Request.Form("Style"))
Colour = ChkString(Request.Form("Colour"))
Exclusive = ChkString(Request.Form("Exclusive"))
Price_Break_QTY = ChkString(Request.Form("Price_Break_QTY"))
Status = ChkString(Request.Form("Status"))
State_Availability = ChkString(Request.Form("State_Availability"))
Date = ChkString(Request.Form("Date"))
data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
Server.MapPath("NCRform.mdb")
sql_insert = "insert INTO Results (Branch_Number, State, Requested_By, Description, Supplier_Name, List_Price, Invoice_Discount, Price_List_Date, UOM, Supplier_Part_Number, Multiple_Order_Quantity, Minimum_Order_Quantity, Reason, Projected_Sales, Alternative_Code, JDE_Code, Department, Group, Sub_Group, Brand, Style, Colour, Exclusive, Price_Break_QTY, Status, State_Availability, Date) values ('" & _
Branch_Number & "', '" & State & "', '" & Requested_By & "', '" & Description & "', '" & Supplier_Name & "', '" & List_Price & "', '" & Invoice_Discount & "', '" & Price_List_Date & "', '" & UOM & "', '" & Supplier_Part_Number & "', '" & Multiple_Order_Quantity & "', '" & Minimum_Order_Quantity & "', '" & Reason & "', '" & Projected_Sales & "', '" & Alternative_Code & "', '" & JDE_Code & "', '" & Department & "', '" & Group & "', '" & Sub_Group & "', '" & Brand & "', '" & Style & "', '" & Colour & "', '" & Exclusive & "', '" & Price_Break_QTY & "', '" & Status & "', '" & State_Availability & "', '" & Date & "'')"
' Creating Connection Object and opening the database
Set con = Server.CreateObject("ADODB.Connection")
con.Open data_source
con.Execute sql_insert
' Done. Close the connection
con.Close
Set con = Nothing
Response.Write "All records were successfully entered into the database."
%>
</body>
</html>
</code>
I have a horrible feeling it may be in the "" But I have looked and looked and cannot seem to find the issue ( Not that this mesns a lot I am new ) I was wondering if somebody could cast an eye over it and see if they can see the problem.
Thanks In advance
Shocka
<code>
<html>
<head>
</head>
<body>
<%
' Declaring variables
Dim Branch_Number, State, Requested_By, Description, Supplier_Name, List_Price, Invoice_Discount, Price_List_Date, UOM, Supplier_Part_Number, Multiple_Order_Quantity, Minimum_Order_Quantity, Reason, Projected_Sales, Alternative_Code, JDE_Code, Department, Group, Sub_Group, Brand, Style, Colour, Exclusive, Price_Break_QTY, Status, State_Availability, Date, data_source, con, sql_insert
' A Function to check if some field entered by user is empty
Function ChkString(string)
If string = "" Then string = " "
ChkString = Replace(string, "'", "''")
End Function
' Receiving values from Form
Branch_Number = ChkString(Request.Form("Branch_Number"))
State = ChkString(Request.Form("State"))
Requested_By = ChkString(Request.Form("Requested_By"))
Description = ChkString(Request.Form("Description"))
Supplier_Name = ChkString(Request.Form("Supplier_Name"))
List_Price = ChkString(Request.Form("List_Price"))
Invoice_Discount = ChkString(Request.Form("Invoice_Discount"))
Price_List_Date = ChkString(Request.Form("Price_List_Date"))
UOM = ChkString(Request.Form("UOM"))
Supplier_Part_Number = ChkString(Request.Form("Supplier_Part_Number"))
Multiple_Order_Quantity = ChkString(Request.Form("Multiple_Order_Quantity"))
Minimum_Order_Quantity = ChkString(Request.Form("Minimum_Order_Quantity"))
Reason = ChkString(Request.Form("Reason"))
Projected_Sales = ChkString(Request.Form("Projected_Sales"))
Alternative_Code = ChkString(Request.Form("Alternative_Code"))
JDE_Code = ChkString(Request.Form("JDE_Code"))
Department = ChkString(Request.Form("Department"))
Group = ChkString(Request.Form("Group"))
Sub_Group = ChkString(Request.Form("Sub_Group"))
Brand = ChkString(Request.Form("Brand"))
Style = ChkString(Request.Form("Style"))
Colour = ChkString(Request.Form("Colour"))
Exclusive = ChkString(Request.Form("Exclusive"))
Price_Break_QTY = ChkString(Request.Form("Price_Break_QTY"))
Status = ChkString(Request.Form("Status"))
State_Availability = ChkString(Request.Form("State_Availability"))
Date = ChkString(Request.Form("Date"))
data_source = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & _
Server.MapPath("NCRform.mdb")
sql_insert = "insert INTO Results (Branch_Number, State, Requested_By, Description, Supplier_Name, List_Price, Invoice_Discount, Price_List_Date, UOM, Supplier_Part_Number, Multiple_Order_Quantity, Minimum_Order_Quantity, Reason, Projected_Sales, Alternative_Code, JDE_Code, Department, Group, Sub_Group, Brand, Style, Colour, Exclusive, Price_Break_QTY, Status, State_Availability, Date) values ('" & _
Branch_Number & "', '" & State & "', '" & Requested_By & "', '" & Description & "', '" & Supplier_Name & "', '" & List_Price & "', '" & Invoice_Discount & "', '" & Price_List_Date & "', '" & UOM & "', '" & Supplier_Part_Number & "', '" & Multiple_Order_Quantity & "', '" & Minimum_Order_Quantity & "', '" & Reason & "', '" & Projected_Sales & "', '" & Alternative_Code & "', '" & JDE_Code & "', '" & Department & "', '" & Group & "', '" & Sub_Group & "', '" & Brand & "', '" & Style & "', '" & Colour & "', '" & Exclusive & "', '" & Price_Break_QTY & "', '" & Status & "', '" & State_Availability & "', '" & Date & "'')"
' Creating Connection Object and opening the database
Set con = Server.CreateObject("ADODB.Connection")
con.Open data_source
con.Execute sql_insert
' Done. Close the connection
con.Close
Set con = Nothing
Response.Write "All records were successfully entered into the database."
%>
</body>
</html>
</code>