Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7508437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:40:56+00:00 2026-05-29T22:40:56+00:00

Please take a look at two connection strings, One to Access database and the

  • 0

Please take a look at two connection strings, One to Access database and the other to SQL Server database.

The connection to Access database worked flawlessly until we recently changed hosting companies and moved to godaddy.com

They provided us with the connection string to SQL Server database.

Since then, we are unable to succecssfully connect to SQL Server. We kept getting 500 (internal error).

I tried contacting them and they kept telling us nobody else is having the same problem which I find very hard to believe.

Can you please see if you can find anything that I might be missing?

Many thanks to you all.

''# Access DB Connection String

<%
  Dim objConn, objRS
  ''# Set objConn = Server.CreateObject("ADODB.Connection")
  ''# objConn.Open "DSN=ship"

 Set objConn=Server.CreateObject("ADODB.Connection")
 objConn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
 "DATA SOURCE=" & server.mappath("admin\scart.mdb")

  Set objRS = objConn.Execute("SELECT * FROM logins WHERE Username = '" & Request.Form("txtUsername") & "' AND password = '" & Request.Form("TxtPassword") & "' ")
  If Not objRS.EOF Then
    If objRS(1) = Request.Form("txtPassword") Then
      Session.Contents("access_level") = objRS(2)
      Session.Contents("ID") = objRS(3) ''#ID column
      Session("username") = objRS("USERNAME")
      Session("password") = objRS("password")
      Response.Redirect "setup.asp"
    Else
      Response.Write "Sorry, but the password that you entered is incorrect.&nbsp;<a href='setup.asp'>Try again</a>"
    End If
  Else
    Response.Write "Sorry, but the username that you entered does not exist.&nbsp;<a href='setup.asp'>Try again</a>"
  End If
  objRS.Close
  Set objRS = Nothing
  objConn.Close
  Set objConn = Nothing
%>


<%
''# SQL Server connection string
Dim objConn, objRS
Dim qry, connectstr
Dim db_name, db_username, db_userpassword
Dim db_server

db_server = "MyServer name"
db_name = "nyDBName"
db_username = "MyUsername"
db_userpassword = "MyPassword"

connectstr = "Driver={SQL Server};SERVER=" & db_server & ";DATABASE=" & db_name & ";UID=" & db_username & ";PWD=" & db_userpassword

Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open connectstr


  SQL = "SELECT * FROM logins WHERE Username = '" & Request.Form("txtUsername") & "' AND password = '" & Request.Form("TxtPassword") & "' "
  response.write sql
  response.end
  Set objRS = objConn.Execute(SQL)

  If Not objRS.EOF Then
    If objRS(1) = Request.Form("txtPassword") Then
      Session.Contents("access_level") = objRS(2)
      Session.Contents("ID") = objRS(3) ''# ID column
      Session("username") = objRS("USERNAME")
      Session("password") = objRS("password")
      Response.Redirect "setup.asp"
    Else
      Response.Write "Sorry, but the password that you entered is incorrect.&nbsp;<a href='setup.asp'>Try again</a>"
    End If
  Else
    Response.Write "Sorry, but the username that you entered does not exist.&nbsp;<a href='setup.asp'>Try again</a>"
  End If
  objRS.Close
  Set objRS = Nothing
  objConn.Close
  Set objConn = Nothing
%>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T22:40:57+00:00Added an answer on May 29, 2026 at 10:40 pm

    From your question, it’s not very clear whether you want to connect to the access/mdb or the sqlserver.

    But anyway, one of the two articles below will cover you.

    http://support.godaddy.com/help/article/259

    http://support.godaddy.com/help/256/connecting-to-a-microsoft-sql-server-database-using-aspado

    However, since in the code snippet you have shared with us, the userinput (Request.Form(“txtUsername”) is directly placed into the SQL statement without any sanitization, it’s a matter of days that your database may be subjected to a big time SQL-Injection.

    From this perspective, I can tell that you are lucky that you were not able to connect.

    First and foremost, sanitize your userinput. Sanitization is a big sujbject.
    But try these as an immediate solution.

    dim txtUsername,txtPassword
    txtUsername = Request.Form("txtUsername") 
    txtPassword = Request.Form("txtPassword")
    
    'sanitize
    txtPassword = replace(txtPassword,"'","''",1,-1,1)
    txtUsername = replace(txtUsername,"'","''",1,-1,1) 
    
    Set objRS = objConn.Execute("SELECT * FROM logins WHERE Username = '" & txtUsername & "' AND password = '" & TxtPassword & "' ")
    

    After fixing the code as above, then and only then, you should worry about fixing the original connection issue. So, pead about SQL Injection, and while you are at it, also read XSS ( Cross-Site-Scripting )

    And make sure, every coder in your company read it and understand what these two things are. You will be glad you did. Or you guys will be in a miserable state sooner or later.

    Good luck…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

please take a look at the two following c statements printf(a very long string);
Please take a look at the html listed below and let me know why
Please take a look at the following .htaccess ErrorDocument 404 /404/ RewriteEngine On RewriteRule
Please take a look here: alt text http://img16.imageshack.us/img16/2810/errrp.jpg Why i got that error when
Please take a look at this example: #include <iostream> #include <vector> #include <string> using
Please take a look at this code: template<class T> class A { class base
I am getting a little confused and need some help please. Take these two
Please take a look at this below line of code in JSF <h:inputText id=name
Please take a look at: http://www.binarymark.com/Products/PasswordGenerator/default.aspx (the Overview tab, on the diagram). The issue
Please take a look at this site --> http://vanityclaire.com/ (in case it changes in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.