apostrophe in asp

Status
Not open for further replies.

itness

Beta member
Messages
1
anyone please help me.

i am presently update one database online site.

My back end is MS Access and front end asp.

there are some fields that have apostrophe or need to add some information with apostrophe.

I already replace the apostrophe by I got this error:

Error Type:
Microsoft VBScript runtime (0x800A0009)
Subscript out of range: '[number: 1]'

here is the code:
for the request form:

<td width="39%"><div align="center">Branch: (required)

<select name="trainbranch" tabindex="5">
<option value="NOT_SELECTED" selected>Please Select
a School/Branch</option>
<% sql = "SELECT * FROM branch where branch <> '"&session ("branch")&"' ORDER BY branch"
rs.open sql, cn
if not rs.eof then
do until rs.eof
response.write "<option value='" & rs("branch") & "::" & rs("department_sk")&"'>" & rs("branch") & "</option>"
rs.movenext
loop
end if
rs.close
%>
</select>


</div></td>

To insert in the database
BranchArray = Split(trim(request.form("trainbranch")),"::")
branch = SchoolBranchArray(0)
department_sk = SchoolBranchArray(1)

For SQL code:

sql = "Insert into Branch (STAFF_SK, COURSE_NAME, BRANCH, START_DATE, PROVIDER_NAME, FUND_SOURCE, HOURS, DIRECT_COSTS, ERT_COSTS, SCHOOL_COSTS, BRANCH_COSTS, DEPARTMENT_SK, PROGRAM_TYPE) " & _ "
VALUES ("&session("staffsk")&",'"&sqlsafe(course)&"','"&branch&"',#"&startdate&"#,"&provider&","&funding&")"
'response.write sql
rs.open sql, cn


please help me to solve this.
 
Code:
BranchArray = Split(trim(request.form("trainbranch")),"::")
branch = SchoolBranchArray(0)
department_sk = SchoolBranchArray(1)

change brancharray to schoolbrancharray
 
Status
Not open for further replies.
Back
Top Bottom