Hi all,
Hope everyone is doing well. Actually I am not a programmer and I do know how to use dreamweaver to create a simple programming task. Recently my boss ask me to create this small application to isert some data into the database. But the trick is, he wanted the user to key in 5 different email in five textfield and submit into the db in the same column.
Sample I key in 5 textfiled and insert into one column name "email"
Below is my code where i encounter duplicate insertion
I try using array but since I am not a programmer I dun which is the proper way to program it.
Please help!
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../Connections/test_multi.asp" -->
<%
Set objConn = CreateObject("ADODB.Connection")
objConn.Open MM_test_multi_STRING
date1 = request.form("date")
StaffID = request.form("StaffID")
recCount = request.form("Email").count
Redim ArryEmail(recCount)
Redim ArryEmail2(recCount)
Redim ArryEmail3(recCount)
Redim ArryEmail4(recCount)
for i = 0 to recCount - 1
ArryEmail(i) = request.form("Email")(i+1)
ArryEmail2(i) = request.form("Email2")(i+1)
ArryEmail3(i) = request.form("Email3")(i+1)
ArryEmail4(i) = request.form("Email4")(i+1)
next
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>RHB Unit Trust Management Berhad</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../../css/default.css" rel="stylesheet" type="text/css">
</head>
<%
for i = 0 to reccount -1
strSql = " insert into test_multi (Email, Email, Email, Email, StaffID, [Date]) values ( " & ArryEmail(i) & ", '" & ArryEmail2(i) & "', '" & ArryEmail3(i) & "', '" & ArryEmail4(i) & "', '" & StaffID & "', #" & Date1 & "#)"
'response.write("<BR>" & strSql)
objConn.Execute(strSql)
next
%>
<body>
<p align="center"><font face="Arial, Helvetica, sans-serif" size="2">Data update
sucessfully</font></p>
<p align="center"> </p>
<p align="center"><font color="#000000"><font size="1" face="Arial, Helvetica, sans-serif">©2004,
RHB Unit Trust Management Berhad- </font></font><font size="1" face="Arial, Helvetica, sans-serif"><br>
</font></p>
</body>
</html>
<%
objConn.Close()
%>
Hope everyone is doing well. Actually I am not a programmer and I do know how to use dreamweaver to create a simple programming task. Recently my boss ask me to create this small application to isert some data into the database. But the trick is, he wanted the user to key in 5 different email in five textfield and submit into the db in the same column.
Sample I key in 5 textfiled and insert into one column name "email"
Below is my code where i encounter duplicate insertion
I try using array but since I am not a programmer I dun which is the proper way to program it.
Please help!
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../Connections/test_multi.asp" -->
<%
Set objConn = CreateObject("ADODB.Connection")
objConn.Open MM_test_multi_STRING
date1 = request.form("date")
StaffID = request.form("StaffID")
recCount = request.form("Email").count
Redim ArryEmail(recCount)
Redim ArryEmail2(recCount)
Redim ArryEmail3(recCount)
Redim ArryEmail4(recCount)
for i = 0 to recCount - 1
ArryEmail(i) = request.form("Email")(i+1)
ArryEmail2(i) = request.form("Email2")(i+1)
ArryEmail3(i) = request.form("Email3")(i+1)
ArryEmail4(i) = request.form("Email4")(i+1)
next
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>RHB Unit Trust Management Berhad</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../../css/default.css" rel="stylesheet" type="text/css">
</head>
<%
for i = 0 to reccount -1
strSql = " insert into test_multi (Email, Email, Email, Email, StaffID, [Date]) values ( " & ArryEmail(i) & ", '" & ArryEmail2(i) & "', '" & ArryEmail3(i) & "', '" & ArryEmail4(i) & "', '" & StaffID & "', #" & Date1 & "#)"
'response.write("<BR>" & strSql)
objConn.Execute(strSql)
next
%>
<body>
<p align="center"><font face="Arial, Helvetica, sans-serif" size="2">Data update
sucessfully</font></p>
<p align="center"> </p>
<p align="center"><font color="#000000"><font size="1" face="Arial, Helvetica, sans-serif">©2004,
RHB Unit Trust Management Berhad- </font></font><font size="1" face="Arial, Helvetica, sans-serif"><br>
</font></p>
</body>
</html>
<%
objConn.Close()
%>
Comment