<%
Dim sMode,intClubID,strClubName,strClubUsername, strClubPwd,intCkType,intCheckType
Dim sql_cInsert, sql_EDITClub
Dim objConn, strConnection, objRs
Set objConn = Server.CreateObject("ADODB.Connection")
strConnection = "Driver={Microsoft Access Driver (*.mdb)};Dbq=" & Server.MapPath("lions.mdb") & ";Uid=Admin;Pwd=;"
objConn.ConnectionString = strConnection
objConn.Open()
Set objRs = Server.CreateObject("ADODB.Recordset")
sMode = Request.QueryString("addMode")
If sMode = "club_add" Then
strClubName = Request.Form("txtClubName")
strClubUsername = Request.Form("txtClubUsername")
strClubPwd = Request.Form("txtClubPwd")
intCheckType = Request.Form("ckClub")
If intCheckType = 0 Then
intCkType = 0
Else
intCktype = 1
End If
sql_cInsert = "Insert into m_clubs(club_name, clogin_name, cpassword, active)" &_
"values('" & strClubName & "','" & strClubUsername & "','" & strClubPwd & "'," & intCkType & ")"
Set objRs = objConn.Execute(sql_cInsert)
Response.Redirect("admin_AddDetails.asp")
ElseIf sMode = "club_edit" Then
intClubID = Request.QueryString("c_id")
sql_EDITClub = "SELECT m_clubs.club_name, m_clubs.active, m_clubs.clogin_name, m_clubs.cpassword" &_
" FROM m_clubs WHERE (((m_clubs.club_id)=" & intClubID & "));"
Set objRs = objConn.Execute(sql_EDITClub)
If Not objRs.EOF Then
strClubName = objRs.Fields("club_name")
strClubUsername = objRs.Fields("clogin_name")
strClubPwd = objRs.Fields("cpassword")
strCk = objRs.Fields("active")
End If
ElseIf sMode = "club_updaterec" Then
intClubID = Request.QueryString("c_id")
strClubName = Request.Form("txtClubName")
strClubUsername = Request.Form("txtClubUsername")
strClubPwd = Request.Form("txtClubPwd")
intCheckType = Request.Form("ckClub")
If intCheckType = 0 Then
strCkType = "0"
Else
strCkType = "1"
End If
sql_EDITClub= "Update m_clubs set club_name='" & strClubName &"',clogin_name='" & strClubUsername & "',cpassword='" & strClubPwd & "',active=" & strCkType & " where club_id=" & intclubID
Set objRs = objConn.Execute(sql_EDITClub)
Response.Redirect("viewAllClubs.asp")
ElseIf strMode = "club_Del" Then
intClubID = Request.QueryString("id")
sql_Del = "Delete from LION_AddNewMember where member_id= " & intMemberID
objConn.Execute sql_Del
Response.Redirect("viewAllcubs.asp")
End If
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Lions Club.....</title>
<link href="style.css" type="text/css" rel="stylesheet">
</head>
<body>
<form name="frmCreateNewClub">
<table width="200" border="0" align="center">
<tr>
<td><img src="images/top_logo.jpg" width="639" height="76"></td>
</tr>
<tr>
<td height="27" class="text14bold2"><div align="center"></div></td>
</tr>
<tr>
<td height="159"><table width="390" border="0" align="center">
<tr>
<td width="115" class="text11whitebold">Club Name </td>
<td colspan="2"><input name="txtClubName" type="text" class="textfield" value="<%=strClubName %>"></td>
</tr>
<tr>
<td class="text11whitebold">User Name </td>
<td colspan="2"><input name="txtClubUsername" type="text" class="textfield" value="<%=strClubUsername%>"></td>
</tr>
<tr>
<td class="text11whitebold">Password</td>
<td colspan="2"><input name="txtClubPwd" type="password" class="textfield" value="<%=strClubPwd%>"></td>
</tr>
<tr>
<td class="text11whitebold">Confirm Password </td>
<td colspan="2"><input name="txtClubConfirmPwd" type="password" class="textfield" value="<%=strClubPwd%>"></td>
</tr>
<tr>
<td> </td>
<td width="26" class="text11whitebold">
<%
If strCk = "True" Then %>
<input name="ckClub" type="checkbox" value="1" Checked>
<% Else %>
<input name="ckClub" type="checkbox" value="1" >
<% End If %>
</td>
<td width="235" class="text11whitebold">Active</td>
</tr>
<tr>
<td> </td>
<td colspan="2">
<input type="button" name="frmClubSubmit" value="ADD" onClick="valClubForm('<%=sMode%>');">
<input type="button" name="frmClubCancel" value="Cancel" onClick="javascript:document.location.href='admin_ AddDetails.asp'"> </td>
</tr>
</table></td>
</tr>
</table>
</form>
</body>
</html>
<script language="javascript" type="text/javascript">
//validate the club form
function valClubForm(sMode)
{
var cMsg = "";
club_ID = "<%=intClubID%>";
if(document.frmCreateNewClub.txtClubName.value=="" )
cMsg += "Club Name\n";
if(document.frmCreateNewClub.txtClubUsername.value =="")
cMsg += "Username\n";
if(document.frmCreateNewClub.txtClubPwd.value=="")
cMsg += "Password\n";
if(document.frmCreateNewClub.txtClubPwd.value!=doc ument.frmCreateNewClub.txtClubConfirmPwd.value)
cMsg = cMsg + "Password and Confirm password are not equal\n";
if(cMsg!="")
{
cMsg = "Please enter the following details \n" + cMsg;
alert(cMsg);
}
else
{
document.frmCreateNewClub.method="post";
if(sMode == "club_edit")
document.frmCreateNewClub.action="addNew_club.asp? addMode=club_updaterec&c_id=" + club_ID;
else
document.frmCreateNewClub.action="addNew_club.asp? addMode=club_add";
document.frmCreateNewClub.submit();
}
}
</script>
I GET AN ERROR..........[Operation must use an updateable query.