If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Connection to Database

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-20-08, 12:00
wisdom2004 wisdom2004 is offline
Registered User
 
Join Date: Sep 2008
Posts: 13
Connection to Database

Hi,
I have a database that was on server, unfortunatly the server was moved and we couldn't find the database, we have a copy of the database and the website. but i don't know to reformalet the Code so the information will be pull from a Ms access database that is stored in a drive here is the code that was used before :

<%@ Language=VBScript%>
<%
dim txtform1

dim Name
dim Ext
dim I1
dim I2
dim I3
dim I4
dim I5
dim I6
dim I7
dim I8
dim I9
dim I10
dim I11
dim I12
dim I13
dim I14
dim I15
dim I16
dim I17
dim I18
dim I19
dim I20
dim I21
dim I22
dim I23
dim I24
dim I25
dim I26
dim I27
dim I28
dim I29
dim I30
dim I31
dim I32
dim I33
dim I34
dim I35
dim I36
dim I37
dim I38
dim I39
dim I40
dim I41
dim I42
dim I43
dim I44
dim I45
dim I46
dim I47
dim I48
dim I49
dim I50
dim I51
dim I52

dim intCompleteFormID
dim DSNTemp 'Access Connection value holder
dim rsSurvey 'Recordset Variable
dim rsMaxRec
dim Connect
%>


<%
'**********Create the connection object********************
'Set objConn=Server.CreateObject("ADODB.connection")
'DSNTemp="DRIVER={Microsoft Access Driver (*.mdb)};"
'DSNTemp= DSNTemp & " DBQ=" & server.mappath("UWAY.mdb")
'objConn.Open DSNTemp

Set Connect = Server.CreateObject("ADODB.Connection")
sConn = "Provider=SQLOLEDB; "
sConn = sConn & "Data Source=SERVER00103; "
sConn = sConn & "Initial Catalog=CHARITY; "
sConn = sConn & "User ID=mod; "
sConn = sConn & "Password=mod;"
Connect.ConnectionString = sConn
Connect.Open


Set rsSurvey=Server.CreateObject("ADODB.Recordset")
rsSurvey.Open "tblSurveyDetail",Connect ,3,3

Name=Request.Form ("Name")
Ext=Request.Form ("Ext")
I1=Request.Form ("I1")
I2=Request.Form ("I2")
I3=Request.Form ("I3")
I4=Request.Form ("I4")
I5=Request.Form ("I5")
I6=Request.Form ("I6")
I7=Request.Form ("I7")
I8=Request.Form ("I8")
I9=Request.Form ("I9")
I10=Request.Form ("I10")
I11=Request.Form ("I11")
I12=Request.Form ("I12")
I13=Request.Form ("I13")
I14=Request.Form ("I14")
I15=Request.Form ("I15")
I16=Request.Form ("I16")
I17=Request.Form ("I17")
I18=Request.Form ("I18")
I19=Request.Form ("I19")
I20=Request.Form ("I20")
I21=Request.Form ("I21")
I22=Request.Form ("I22")
I23=Request.Form ("I23")
I24=Request.Form ("I24")
I25=Request.Form ("I25")
I26=Request.Form ("I26")
I27=Request.Form ("I27")
I28=Request.Form ("I28")
I29=Request.Form ("I29")
I30=Request.Form ("I30")
I31=Request.Form ("I31")
I32=Request.Form ("I32")
I33=Request.Form ("I33")
I34=Request.Form ("I34")
I35=Request.Form ("I35")
I36=Request.Form ("I36")
I37=Request.Form ("I37")
I38=Request.Form ("I38")
I39=Request.Form ("I39")
I40=Request.Form ("I40")
I41=Request.Form ("I41")
I42=Request.Form ("I42")
I43=Request.Form ("I43")
I44=Request.Form ("I44")
I45=Request.Form ("I45")
I46=Request.Form ("I46")
I47=Request.Form ("I47")
I48=Request.Form ("I48")
I49=Request.Form ("I49")
I50=Request.Form ("I50")
I51=Request.Form ("I51")
I52=Request.Form ("I52")
I53=Request.Form ("I53")
I54=Request.Form ("I54")
I55=Request.Form ("I55")
I56=Request.Form ("I56")


rsSurvey.close

rsSurvey.Open "tblSurveyDetail",Connect ,3,3

rsSurvey.Addnew
'rsSurvey("SurveyID") = intCompleteFormID
rsSurvey("Name") = Name
rsSurvey("Ext") = Ext
rsSurvey("I1") = I1
rsSurvey("I2") = I2
rsSurvey("I3") = I3
rsSurvey("I4") = I4
rsSurvey("I5") = I5
rsSurvey("I6") = I6
rsSurvey("I7") = I7
rsSurvey("I8") = I8
rsSurvey("I9") = I9
rsSurvey("I10") = I10
rsSurvey("I11") = I11
rsSurvey("I12") = I12
rsSurvey("I13") = I13
rsSurvey("I14") = I14
rsSurvey("I15") = I15
rsSurvey("I16") = I16
rsSurvey("I17") = I17
rsSurvey("I18") = I18
rsSurvey("I19") = I19
rsSurvey("I20") = I20
rsSurvey("I21") = I21
rsSurvey("I22") = I22
rsSurvey("I23") = I23
rsSurvey("I24") = I24
rsSurvey("I25") = I25
rsSurvey("I26") = I26
rsSurvey("I27") = I27
rsSurvey("I28") = I28
rsSurvey("I29") = I29
rsSurvey("I30") = I30
rsSurvey("I31") = I31
rsSurvey("I32") = I32
rsSurvey("I33") = I33
rsSurvey("I34") = I34
rsSurvey("I35") = I35
rsSurvey("I36") = I36
rsSurvey("I37") = I37
rsSurvey("I38") = I38
rsSurvey("I39") = I39
rsSurvey("I40") = I40
rsSurvey("I41") = I41
rsSurvey("I42") = I42
rsSurvey("I43") = I43
rsSurvey("I44") = I44
rsSurvey("I45") = I45
rsSurvey("I46") = I46
rsSurvey("I47") = I47
rsSurvey("I48") = I48
rsSurvey("I49") = I49
rsSurvey("I50") = I50
rsSurvey("I51") = I51
rsSurvey("I52") = I52
rsSurvey("I53") = I53
rsSurvey("I54") = I54
rsSurvey("I55") = I55
rsSurvey("I56") = I56


rsSurvey.Update

rsSurvey.Close
set rsSurvey = nothing

Connect.Close
set Connect = nothing
%>
Reply With Quote
  #2 (permalink)  
Old 10-20-08, 12:17
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
I'm confused, the connection bit is commented out, so I have no idea how this code is working in the first place.

Generally this would be the line to check
Code:
'DSNTemp= DSNTemp & " DBQ=" & server.mappath("UWAY.mdb")
But as you can see, it's commented out.

P.S. please use [CODE] tags when posting code
__________________
George
Twitter | Blog
Reply With Quote
  #3 (permalink)  
Old 10-20-08, 12:45
wisdom2004 wisdom2004 is offline
Registered User
 
Join Date: Sep 2008
Posts: 13
I was confused too, i couldn't figure out how to make it work, the person that created this code, quite 6 month ago, so i am stuck and don't know how to make it work.
Reply With Quote
  #4 (permalink)  
Old 10-20-08, 13:53
wisdom2004 wisdom2004 is offline
Registered User
 
Join Date: Sep 2008
Posts: 13
Is there a way to link it to a new database?. thanks for your help.
Reply With Quote
  #5 (permalink)  
Old 10-20-08, 21:49
myle myle is offline
(Making Your Life Easy)
 
Join Date: Feb 2004
Location: New Zealand
Posts: 1,143
Look like there was a test database "UWAY.mdb"
Code:
**********Create the connection object********************
'Set objConn=Server.CreateObject("ADODB.connection")
'DSNTemp="DRIVER={Microsoft Access Driver (*.mdb)};"
'DSNTemp= DSNTemp & " DBQ=" & server.mappath("UWAY.mdb")
'objConn.Open DSNTemp
then is was put on to SQL server

Code:
Set Connect = Server.CreateObject("ADODB.Connection")
sConn = "Provider=SQLOLEDB; "
sConn = sConn & "Data Source=SERVER00103; "
sConn = sConn & "Initial Catalog=CHARITY; "
sConn = sConn & "User ID=mod; "
sConn = sConn & "Password=mod;"
Connect.ConnectionString = sConn
Connect.Open
or did you comment out the first bit.
__________________
hope this help

See clear as mud


StePhan McKillen
the aim is store once, not store multiple times
Remember... Optimize 'til you die!
Progaming environment:
Access based on my own environment: DAO3.6/A97/A2000/A2003
VB based on my own environment: vb6 sp5
ASP based on my own environment: 5.6
VB-NET based on my own environment started 2007
SQL-2005 based on my own environment started 2008
MYLE
Reply With Quote
  #6 (permalink)  
Old 10-20-08, 22:24
wisdom2004 wisdom2004 is offline
Registered User
 
Join Date: Sep 2008
Posts: 13
Thanks everybody for the help, i did figure out how to make work. i did change the server name and created a new table with same criteria and it work fine.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On