ASP SQL DataConnection Error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dragiton
    New Member
    • Apr 2008
    • 12

    ASP SQL DataConnection Error

    I am trying to update a record set to a SQL db with the following code and connection string. Does anyone have any suggestions for the following error?

    Microsoft JET Database Engine error '80004005'

    Could not find file 'C:\WINNT\syste m32\ConnStr'.

    /test_data_form. asp, line 114

    ((((((Line 114 is as follows: objConn.Open "ConnStr")) )))

    html form and asp code below:::::::::: ::::






    Code:
       
    <form id="form1" name="form1" method="post" action="test_data_form.asp">
    <label>First Name
    <input type="text" name="FirstName" id="FirstName" />
    </label>
    <label>Last Name
    <input type="text" name="LastName" id="LastName" />
    </label>
    <label>Phone
    <input type="text" name="Phone" id="Phone" />
    </label>
    <label>Email
    <input type="text" name="Email" id="Email" />
    </label>
    <label>Message
    <textarea name="Message" id="Message" cols="45" rows="5"></textarea>
    </label>
    <label>Submit Form
    <input type="submit" name="Submit" id="Submit" value="Submit" />
    </label>
    </form>
     
     
     
     
    <%
    dim objConn, objRS
    set objConn = server.createObject("adodb.connection")
    objConn.Provider="Microsoft.Jet.OLEDB.4.0"
    objConn.Open "ConnStr"
    	 %>
     
     
    	 <%
     
    dim query
    set objRS = server.createObject("adodb.recordset")
    query = "SELECT * FROM duff"
    objRS.open SQL, objConn
    	 %>
     
    <%
    objRS.addNew
    objRS("FirstName") = request("FirstName")
    objRS("Lastname") = request("LastName")
    objRS("Phone") = request("Phone")
    	 objRS("Email") = request("Email")
    	 objRS("Message") = request("Message")
    objRS.update
    	 %>
    Last edited by DrBunchman; May 1 '08, 09:20 AM. Reason: Added code tags - note the # button
  • DrBunchman
    Recognized Expert Contributor
    • Jan 2008
    • 979

    #2
    Hi dragiton,

    The error is caused by the double quotes you've put around ConnStr.

    ConnStr is presumably your connection string variable (which you need to define at some point prior to opening the connection). Putting "" marks around it means it will be interpreted as a string rather than a variable.

    Hope this helps,

    Dr B

    Comment

    • dragiton
      New Member
      • Apr 2008
      • 12

      #3
      after removing the double quotes I get the following error:


      Microsoft JET Database Engine error '80004005'

      Could not find installable ISAM.

      /test_data_form. asp, line 114


      Any advise?

      Comment

      • DrBunchman
        Recognized Expert Contributor
        • Jan 2008
        • 979

        #4
        Where do you define your connection string variable ConnStr and what does it contain?

        Dr B

        Comment

        • dragiton
          New Member
          • Apr 2008
          • 12

          #5
          I have a global.asa file with the following connection string.

          ConnStr = "driver={SQ L Server};server= sql.myhost.com; uid=myuserid;pw d=barterkc;data base=DBname"


          I am trying to just pass simple data and not do much with it. So I would be interested in how to open the DB connection correctly within the asp page as well as how to properly use the global.asa

          Thanks,

          Comment

          • DrBunchman
            Recognized Expert Contributor
            • Jan 2008
            • 979

            #6
            This error is generally caused by a problem with your connection string - have you used this connection string before? You could try to connect using a different one (like the one below) and see if that works.

            Code:
            ConnStr="data source=sql.myhost.com;uid=myuserid;pwd=barterkc;inital catalog=DBname"
            Let me know how it goes.

            Dr B

            Comment

            Working...