PC Review


Reply
Thread Tools Rate Thread

Connecting to a MSSQL database

 
 
Pictures
Guest
Posts: n/a
 
      2nd Aug 2005
I created a form using FP but I cannot seem to get it to connect to the
database. When I click submit, it shows the confirmation page, but nothing
ever gets put in the database.

here is the script. I am really new to MSSQL. I am guessing that I need a
connection string, not sure. If someone could take a look at it for me I
would appreciate it greatly. If it is a connection string I need, please
let me know where It goes in all of this.

thanks in advance for your help.


<%
' FP_ASP ASP Automatically generated by a Frontpage Component. Do not Edit.

On Error Resume Next
Session("FP_OldCodePage") = Session.CodePage
Session("FP_OldLCID") = Session.LCID
Session.CodePage = 1252
Err.Clear

strErrorUrl = ""

If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
If Request.Form("VTI-GROUP") = "0" Then
Err.Clear

Set fp_conn = Server.CreateObject("ADODB.Connection")
FP_DumpError strErrorUrl, "Cannot create connection"

Set fp_rs = Server.CreateObject("ADODB.Recordset")
FP_DumpError strErrorUrl, "Cannot create record set"

fp_conn.Open Application("rbtsql_ConnectionString")
FP_DumpError strErrorUrl, "Cannot open database"

fp_rs.Open "MotorcycleClubs", fp_conn, 1, 3, 2 ' adOpenKeySet,
adLockOptimistic, adCmdTable
FP_DumpError strErrorUrl, "Cannot open record set"

fp_rs.AddNew
FP_DumpError strErrorUrl, "Cannot add new record set to the database"
Dim arFormFields0(26)
Dim arFormDBFields0(26)
Dim arFormValues0(26)

arFormFields0(0) = "CharterYear"
arFormDBFields0(0) = "CharterYear"
arFormValues0(0) = Request("CharterYear")
arFormFields0(1) = "StreetAddress"
arFormDBFields0(1) = "StreetAddress"
arFormValues0(1) = Request("StreetAddress")
arFormFields0(2) = "ClubChartered"
arFormDBFields0(2) = "ClubChartered"
arFormValues0(2) = Request("ClubChartered")
arFormFields0(3) = "MembershipType"
arFormDBFields0(3) = "MembershipType"
arFormValues0(3) = Request("MembershipType")
arFormFields0(4) = "Province"
arFormDBFields0(4) = "Province"
arFormValues0(4) = Request("Province")
arFormFields0(5) = "WhichBrand"
arFormDBFields0(5) = "WhichBrand"
arFormValues0(5) = Request("WhichBrand")
arFormFields0(6) = "ClubPresident"
arFormDBFields0(6) = "ClubPresident"
arFormValues0(6) = Request("ClubPresident")
arFormFields0(7) = "BikeStyle"
arFormDBFields0(7) = "BikeStyle"
arFormValues0(7) = Request("BikeStyle")
arFormFields0(8) = "ClubColors"
arFormDBFields0(8) = "ClubColors"
arFormValues0(8) = Request("ClubColors")
arFormFields0(9) = "BrandSpecific"
arFormDBFields0(9) = "BrandExclusive"
arFormValues0(9) = Request("BrandSpecific")
arFormFields0(10) = "PresidentsEmail"
arFormDBFields0(10) = "PresidentEmailAddress"
arFormValues0(10) = Request("PresidentsEmail")
arFormFields0(11) = "Affiliations"
arFormDBFields0(11) = "Affiliations"
arFormValues0(11) = Request("Affiliations")
arFormFields0(12) = "PRO"
arFormDBFields0(12) = "PRO"
arFormValues0(12) = Request("PRO")
arFormFields0(13) = "ClubEmailAddress"
arFormDBFields0(13) = "ClubEmailAddress"
arFormValues0(13) = Request("ClubEmailAddress")
arFormFields0(14) = "City"
arFormDBFields0(14) = "City"
arFormValues0(14) = Request("City")
arFormFields0(15) = "YearEstablished"
arFormDBFields0(15) = "YearEstablished"
arFormValues0(15) = Request("YearEstablished")
arFormFields0(16) = "PRONumber"
arFormDBFields0(16) = "PRONumber"
arFormValues0(16) = Request("PRONumber")
arFormFields0(17) = "ZipCode"
arFormDBFields0(17) = "ZipCode"
arFormValues0(17) = Request("ZipCode")
arFormFields0(18) = "NumberOfMembers"
arFormDBFields0(18) = "NumberOfMembers"
arFormValues0(18) = Request("NumberOfMembers")
arFormFields0(19) = "ClubType"
arFormDBFields0(19) = "ClubType"
arFormValues0(19) = Request("ClubType")
arFormFields0(20) = "SecondaryEmailAddress"
arFormDBFields0(20) = "SecondaryEmailAddress"
arFormValues0(20) = Request("SecondaryEmailAddress")
arFormFields0(21) = "PROEmail"
arFormDBFields0(21) = "PROEmailAddress"
arFormValues0(21) = Request("PROEmail")
arFormFields0(22) = "Country"
arFormDBFields0(22) = "Country"
arFormValues0(22) = Request("Country")
arFormFields0(23) = "State"
arFormDBFields0(23) = "State"
arFormValues0(23) = Request("State")
arFormFields0(24) = "ClubName"
arFormDBFields0(24) = "ClubName"
arFormValues0(24) = Request("ClubName")
arFormFields0(25) = "ClubWebSite"
arFormDBFields0(25) = "ClubWebSite"
arFormValues0(25) = Request("ClubWebSite")

FP_SaveFormFields fp_rs, arFormFields0, arFormDBFields0

If Request.ServerVariables("REMOTE_USER") <> "" Then
FP_SaveFieldToDB fp_rs, Request.ServerVariables("REMOTE_USER"), "ID"
End If

fp_rs.Update
FP_DumpError strErrorUrl, "Cannot update the database"

fp_rs.Close
fp_conn.Close

Session("FP_SavedFields")=arFormFields0
Session("FP_SavedValues")=arFormValues0
Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")
Response.Redirect "Confirmation.asp"

End If
End If

Session.CodePage = Session("FP_OldCodePage")
Session.LCID = Session("FP_OldLCID")

%>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Prob: Connecting to MSSQL using windows authentication Peter Lykkegaard Microsoft ASP .NET 7 21st Apr 2009 04:48 AM
Exception when connecting to MsSQL server bg_ie@yahoo.com Microsoft C# .NET 1 7th Mar 2007 04:25 PM
Connecting to MSSQL without a database no0obster@gmail.com Microsoft C# .NET 3 13th May 2006 01:48 PM
Connecting MSACCESS Frontend to MSSQL backend =?Utf-8?B?QmlsbA==?= Microsoft Access 2 4th Mar 2005 08:54 PM
C# XML -> MSSQL Database Pratik Parikh Microsoft C# .NET 2 6th Aug 2003 02:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:47 PM.