Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2008
    Posts
    13

    Unanswered: 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
    %>

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    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
    Home | Blog

  3. #3
    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.

  4. #4
    Join Date
    Sep 2008
    Posts
    13
    Is there a way to link it to a new database?. thanks for your help.

  5. #5
    Join Date
    Feb 2004
    Location
    New Zealand
    Posts
    1,424
    Provided Answers: 8
    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/A2007/A2010
    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
    YOUR PASSWORD IS JUST LIKE YOUR TOOTHBRUSH DON'T SHARE IT.

  6. #6
    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.

Posting Permissions

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