>1. problem while inserting data into MS acess using asp
hi this is the code with some modifications, it's work fine.
Only change the path of your tulasi.mdb
:)
<%
dim conn
dim rs
dim sql
folder=Request.form("T1")
param=request("pg")
' If the user push "submit" ....
if param = 1 then
if folder = "" then%>
<script>alert('no data entered');
document.location="test.asp";
</script>
<%
else
sql="select * from folder where foldername='"&folder&"'"
set conn=server.createObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.open "C:\tulasi.mdb"
set rs=server.createObject("ADODB.recordset")
rs.open sql,conn
if not rs.EOF then
if rs("foldername")=folder then %>
<script>alert('folder already exits..try another name');
document.location ="test.asp";
</script>
<%
end if
end if ' end if folder = "" then ....
if param =1 and rs.EOF then
'response.write "insert into folder values('"&folder&"')" & "<br>"
conn.execute("insert into folder values('"&folder&"')")
response.write "<script language=""JavaScript"">alert('Data Added');"
response.write "document.location=""test.asp"";</script>"
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
end if ' end if folder = "" then
end if
%>
<html>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<body>
<!-- here in action you can add a param, in more cases this is not very useful
depend of the complexity of your application -->
<form method="POST" action="test.asp?pg=1" name="form1">
<p>Enter folder name:<input type="text" name="T1" size="20"></p>
<p>
<input type="submit" value="Submit" name="B1"></p>
</form>
</body>
</html>
___________________________________________________
GO.com Mail
Get Your Free, Private E-mail at http://mail.go.com