Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 03-29-2006, 11:25 PM   #1 (permalink)
 
Newb Techie

Join Date: Mar 2006

Posts: 1

itness

Default apostrophe in asp

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)&"','"&b ranch&"',#"&startdate&"#,"&provider&","&funding&") "
'response.write sql
rs.open sql, cn


please help me to solve this.
itness is offline  
Old 04-03-2006, 10:22 PM   #2 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,410

office politics will become famous soon enough

Default

Code:
BranchArray = Split(trim(request.form("trainbranch")),"::")
branch = SchoolBranchArray(0)
department_sk = SchoolBranchArray(1)
change brancharray to schoolbrancharray
office politics is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On