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 -
<!-- #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
-
-
%>
-
validatelogin.asp (This will check whether user exists or not) -
<!-- #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
-
-
-
-
%>
-
function_login.asp (This will submit the information of user) -
-
<!-- #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
1 1372
You declared a connection object with a name "conn" in connection.asp but you refer to it as "con" (single n) in function_login.asp
If you want to insert a record, you should make use of the connection object which was opened in connection.asp and use the execute method.
Code: - query="insert into Login (UserName,Password,Branch,Status)values('"& uname &"','"& pass &"', '" "',1)"
-
conn.execute query
-
conn.close
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Refky Wahib |
last post by:
Hi
I need Technical Support
I finished a Great project using .Net and SQL Server and .Net Mobile
Control
My Business case is to implement this Program to accept about 1
Million concurrent...
|
by: Refky Wahib |
last post by:
Hi
Actually I need Technical Support
I finished a Great project using .Net and SQL Server and .Net Mobile
Control
My Business case is to implement this Program to accept about 1
Million...
|
by: Rahul Anand |
last post by:
Getting SQL Exception when trying to implement Connection
based Trasaction using SQL Helper class.
I am using the follwing function to execute my stored
procs:
-=-=-=-
ExecuteScalar(ByVal...
|
by: BBC1009 |
last post by:
I have an application connected to an overseas sql-server using port 1433.
But recently it always timeout the connection. Any solution to avoid
this??? I am using the VB.net Windowed Form with...
|
by: mortenol |
last post by:
Hi, I am trying to connect a MS SSIS package to an AS400/DB2 database,
and I experience problem when I hit the "Create Package" button in
the "Data Link properties window".
I have understood that...
|
by: Suresh |
last post by:
Hi Guys
I have Db2 server installed on remote server. i am connecting to that
remote server by using VPN.
I want to connect that remote DB2 server instance using my local
machine DB2...
|
by: b_r |
last post by:
Hi,
I'm trying to make a simple operation (insert into DB) in VB 2005 and
SQL Server.
The code is as follows:
Dim sConnectionString As String = _
"Data...
|
by: Usman Jamil |
last post by:
Hi
I've a class that creates a connection to a database, gets and loop on a
dataset given a query and then close the connection. When I use netstat
viewer to see if there is any connection open...
|
by: sherifbk |
last post by:
Problem description
==============
- I have 4 clients and 1 server (SQL server)
- 3 clients are Monitoring console 1 client is operation console
- Monitoring console collects some data from...
|
by: Ryan Liu |
last post by:
Hi,
I have a 100 clients/ one server application, use ugly one thread pre client
approach. And both side user sync I/O.
I frequently see the error on server side(client side code is same, but...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |