Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2012
    Posts
    2

    Unanswered: Having trouble setting up Input Form to MSSQL (help please)

    Hello,

    Note: The Server / DB that I am trying to connect to is local (we have the server in a server room here)

    I am following this tutorial:

    http://tinyurl.com/9c64t5k

    Everything is in place, except I do not know what to put in the "data_source" and "Server.MapPath" fields in the 'form_ac.asp' file.

    It seems like no matter what I put in there (I have tried several different connection strings), that I always get a '500 Internal Server' error as soon as I 'submit' the form. Its like something else is out of place, because it doesn't even seem to check the DB strings (just based on how quickly the 500 error shows up)

    You can see the 'test' form I am working with here:

    http://dealer.electrabike.com/registerTest/form.htm

    And here is the file the form posts to (form_ac.asp):

    Code:
    <%
    ' Declaring variables
    Dim first, last, account, email, state, comments, data_source, con, sql_insert
    
    ' A Function to check if some field entered by user is empty
    Function ChkString(string)
    	ChkString = Replace( Trim(string) , "'", "''")
    End Function
    
    ' Receiving values from Form
    first = ChkString(Request.Form("first"))
    last = ChkString(Request.Form("last"))
    dealer = ChkString(Request.Form("dealer"))
    account = ChkString(Request.Form("account"))
    email = ChkString(Request.Form("email"))
    state = ChkString(Request.Form("state"))
    phone_area = ChkString(Request.Form("phone_area"))
    data_source = Server=IP ADDRESS;Database=DEALER_REQUEST;User Id=myUsername;Password=myPassword; 
    Server.MapPath("form.mdb")
    sql_insert = "insert into users (first, last, dealer, account, email, state, phone_area) values ('" & _
    	first & "', last & "','" & dealer & "', '" & account & "', '" & email & "', '" & state & "', '" & phone_area & "')"
    
    ' Creating Connection Object and opening the database
    Set con = Server.CreateObject("ADODB.Connection")
    con.Open data_source
    con.Execute sql_insert
    
    ' Done. Close the connection
    con.Close
    Set con = Nothing
    %>
    The bold is where I am having issues. No matter what connection string I try, I keep getting the 500 error in my browser.

    I have created the Database in SQL Server Management Studio, and created the table. The screenshot is attached.

    Do you guys see anything out of place? I have never done this before.

    Any help would be greatly appreciated!
    Attached Thumbnails Attached Thumbnails Image11.jpg  
    Last edited by Wolfpack; 10-24-12 at 19:22.

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Based on your connection string, you are using Jet (Microsoft Access).

    You need to use Mcirosoft SQL Server instead.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Oct 2012
    Posts
    2
    Quote Originally Posted by Pat Phelan View Post
    Based on your connection string, you are using Jet (Microsoft Access).

    You need to use Mcirosoft SQL Server instead.

    -PatP
    Thanks for the reply, Pat. I've updated the code in the original post.

    On the (new) connection string, do I just use the local server IP for the 'server'?

    And for the user/pass on the connection string - do I use the same credentials that I log into the server with? (through Remote Desktop Connection)

    Also, I am confused about this line: Server.MapPath("form.mdb")

    Thanks again

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •