Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

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

$
0
0
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 Images
File Type: jpg Image11.jpg (168.9 KB)

Viewing all articles
Browse latest Browse all 13329

Trending Articles