473,320 Members | 2,164 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Problem in connection

114 100+
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

Expand|Select|Wrap|Line Numbers
  1. <!-- #include file="../adovbs.inc" -->
  2.  
  3. <% Dim aConnectionString
  4. aConnectionString = "Provider=SQLOLEDB;Data Source=afcindia;Initial Catalog= afcindia;UserId=afcindia;Password=afc789;"
  5.  
  6. Dim conn,R,SQL,RecsAffected
  7.  
  8. Set conn=Server.CreateObject("ADODB.Connection")
  9. conn.Mode=adModeReadWrite
  10. conn.ConnectionString = aConnectionString
  11. conn.Open
  12.  
  13. %> 
  14.  
validatelogin.asp (This will check whether user exists or not)

Expand|Select|Wrap|Line Numbers
  1. <!-- #include file="include/connection.asp" -->
  2. <%
  3.  
  4. dim username,password
  5. dim query
  6.     username=request("username")
  7.     password=request("password")
  8.     Ltype=request("Ltype")
  9.  
  10.     query="select * from Login where UserName ='" & username & "' and Password='" & password & "'
  11.     set rs=server.CreateObject("adodb.recordset")
  12.     rs.open query,con,1,3
  13.     if rs.eof and rs.bof then
  14.     response.Redirect("default.asp?vartext=Invalid Login !,Try Again.")
  15.     else
  16.     session("username")=username
  17.     session("type")="Admin"
  18.     session("branch")=rs("branch")
  19.     response.Redirect("newmenu.asp")
  20.  
  21.     end if
  22.  
  23.  
  24.  
  25.     %>
  26.  
function_login.asp (This will submit the information of user)

Expand|Select|Wrap|Line Numbers
  1.  
  2. <!-- #include file="include/connection.asp" -->
  3. <% 
  4.  
  5. uname=request("userid")
  6. pass=request("pass")
  7. branch=request("branch")
  8. query1="Select UserName from Login where UserName='"& uname &"'"
  9. set rs1=Server.CreateObject("adodb.recordset")
  10. rs1.Open query1,con,1,3
  11.  
  12. if  rs1.eof and  rs1.bof then 
  13.  
  14. query="insert into Login (UserName,Password,Branch,Status)values('"& uname &"','"& pass &"', '" "',1)"
  15. set rs2=Server.CreateObject("adodb.recordset")
  16. rs2.Open query,con,1,3
  17. response.Redirect("NewLogin.asp?action=done")
  18. else
  19. response.Redirect("NewLogin.asp?action=Exist")
  20. end if 
  21. %>
  22.  



Please advice me where is the problem.


Thanks
Deepak
Apr 13 '07 #1
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:
Expand|Select|Wrap|Line Numbers
  1. query="insert into Login (UserName,Password,Branch,Status)values('"& uname &"','"& pass &"', '" "',1)"
  2. conn.execute query
  3. conn.close
Apr 13 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
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...
1
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...
4
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...
8
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...
0
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...
5
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...
22
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...
5
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...
1
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...
1
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...
0
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...
0
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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...
0
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...
1
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)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
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
0
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.