Function WhiteSpace(StringToConvert, ReplaceChar, ConversionChar)
TempString = StringToConvert
LastFound = instr(TempString, ReplaceChar)
do Until LastFound = 0
TempString = left(TempString, LastFound -
1) & ConversionChar & right(TempString, Len(TempString) - LastFound)
LastFound = instr(TempString, ReplaceChar)
Loop
WhiteSpace = TempString
End Function
'Request Form Variables and Declare SQL variables
Dim txtName, txtAddress, txtCity, strPostcode, intTelephone, intFax,
txtEmail, strSQL
txtName = Request("Name")
txtAddress = Request("Address")
txtCity = Request("City")
strPostcode = Request("Postcode")
intTelephone = Request("Telephone")
intFax = Request("Fax")
txtEmail = Request("Email")
txtName = WhiteSpace(txtName ," ", "_")
txtAddress = WhiteSpace(txtAddress ," ", "_")
txtCity = WhiteSpace(txtCity ," ", "_")
strPostcode = WhiteSpace(strPostcode ," ", "_")
intTelephone = WhiteSpace(intTelephone ," ", "_")
intFax = WhiteSpace(intFax ," ", "_")
txtEmail = WhiteSpace(txtEmail ," ", "_")
'Build SQL Insert Statement
strSQL = "INSERT INTO Customer(Name , Address , City , Postcode ,"
strSQL = strSQL & "Telephone , Fax , Email) "
strSQL = strSQL & "VALUES ('" & txtName & "' , '" & txtAddress & "' , '" &
txtCity & "' , '"
strSQL = strSQL & "" & strPostcode & "' , '" & intTelephone & "' , '" &
intFax & "' , '"
strSQL = strSQL & "" & txtEmail & "')"
***************************************************************************
The code listed above is taken from an application that I am building to
insert the details of customers into a database.
The fields listed in the 'INSERT INTO Customer(' statement exist and the
variables are all populated with data which can be viewed as follows when
Response.Write strSQL is placed in the body of the document
INSERT INTO Customer(Name , Address , City , Postcode ,Telephone , Fax ,
Email)
VALUES 'Customer_Name' , 'Customer_Address' , 'City_of_Origin' , 'Post_or_Z
ip_Code' , '549_68752_5468' , '742541_5663_1554' , 'someone@s...')
Please forgive the wrapping of the text.
Any help would be greatly appreciated.
please email me any solutions at cerithomas@u...