Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - ASP problem with SQL DB
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

ASP problem with SQL DB

 Post Reply Post Reply
Author
ainsworth14 View Drop Down
Groupie
Groupie


Joined: 05 August 2003
Location: United Kingdom
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote ainsworth14 Quote  Post ReplyReply Direct Link To This Post Topic: ASP problem with SQL DB
    Posted: 22 November 2007 at 9:58am
Hi

I have a problem with some ASP script. The code works a treat on my testing server with an access database but fails to work with the SQL database i have on a live server - keeps saying incorrect username

do i need to amend any code in this?

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/fr_record_webtest.asp" -->
<%   
' variables
dim cnStr
dim rcSet
dim frmUsername
dim frmPassword
dim sqlStr

'store form input into variables
frmUsername = Request.Form("form_username")
frmPassword = Request.Form("form_password")

'create connection and recordset objects
Set cnStr = Server.CreateObject("ADODB.Connection")
Set rcSet = Server.CreateObject("ADODB.Recordset")

' defining database connection (connectionstring.asp)
Set cnStr = Server.CreateObject("ADODB.Connection")
cnStr.open strConnectionString

' execute sql and open as recordset
sqlStr = "Select * From adminprofiles where user = '" _
            & frmUsername & "' and password = '" & frmPassword & "'"

' Opens the returned values from the SQL as a recordset, ready for iteration by ASP
set rcSet = cnStr.Execute(sqlStr)

' validate variables against database
If (not rcSet.BOF) and (not rcSet.EOF) then
session("validated_user") = frmUsername
response.write "<h1>Login successful!</h1>"
response.write "<p>Welcome " & rcSet.fields(1) & "</p>"
Session("Authenticated") = 1
response.Redirect ("frr_admin_default.asp")
else
response.write "incorrect username and/or password"
end if
%>
<%
rcSet.Close()
Set rcSet = Nothing
%>

Back to Top
shakir View Drop Down
Groupie
Groupie


Joined: 08 November 2007
Location: Saudi Arabia
Status: Offline
Points: 41
Post Options Post Options   Thanks (0) Thanks(0)   Quote shakir Quote  Post ReplyReply Direct Link To This Post Posted: 05 December 2007 at 4:20pm
what type of connection you are using, describe "strConnectionString", give the connection string values also.. then i can suggest u
Back to Top
jamie.townsend View Drop Down
Groupie
Groupie


Joined: 07 December 2007
Location: England
Status: Offline
Points: 114
Post Options Post Options   Thanks (0) Thanks(0)   Quote jamie.townsend Quote  Post ReplyReply Direct Link To This Post Posted: 07 December 2007 at 11:38am
Have you been able to connect to the SQL Server using just teh conection string without the rest of the code ??
 
Sounds like your connection to the database is not being set correctly.
Check the username/password as this is most likely the problem you are having, if you paste your error here we could advise you further.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.