Dear Friends,
I have designed an MIS modulue but I am facing some problem. The form is not able to connect with the server and I also can not submit my details to the database. Here is the code:
connection.asp
validatelogin.a sp (This will check whether user exists or not)
function_login. asp (This will submit the information of user)
Please advice me where is the problem.
Thanks
Deepak
I have designed an MIS modulue but I am facing some problem. The form is not able to connect with the server and I also can not submit my details to the database. Here is the code:
connection.asp
Code:
<!-- #include file="../adovbs.inc" -->
<% Dim aConnectionString
aConnectionString = "Provider=SQLOLEDB;Data Source=afcindia;Initial Catalog= afcindia;UserId=afcindia;Password=afc789;"
Dim conn,R,SQL,RecsAffected
Set conn=Server.CreateObject("ADODB.Connection")
conn.Mode=adModeReadWrite
conn.ConnectionString = aConnectionString
conn.Open
%>
Code:
<!-- #include file="include/connection.asp" -->
<%
dim username,password
dim query
username=request("username")
password=request("password")
Ltype=request("Ltype")
query="select * from Login where UserName ='" & username & "' and Password='" & password & "'
set rs=server.CreateObject("adodb.recordset")
rs.open query,con,1,3
if rs.eof and rs.bof then
response.Redirect("default.asp?vartext=Invalid Login !,Try Again.")
else
session("username")=username
session("type")="Admin"
session("branch")=rs("branch")
response.Redirect("newmenu.asp")
end if
%>
Code:
<!-- #include file="include/connection.asp" -->
<%
uname=request("userid")
pass=request("pass")
branch=request("branch")
query1="Select UserName from Login where UserName='"& uname &"'"
set rs1=Server.CreateObject("adodb.recordset")
rs1.Open query1,con,1,3
if rs1.eof and rs1.bof then
query="insert into Login (UserName,Password,Branch,Status)values('"& uname &"','"& pass &"', '" "',1)"
set rs2=Server.CreateObject("adodb.recordset")
rs2.Open query,con,1,3
response.Redirect("NewLogin.asp?action=done")
else
response.Redirect("NewLogin.asp?action=Exist")
end if
%>
Please advice me where is the problem.
Thanks
Deepak
Comment