0

I have this piece of code that gives me this when executed:

Microsoft VBScript runtime error '800a01a8'

Object required: 'be01v-sat'

/CFIDE/csv.asp, line 90

The code is:

  If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
    dim server,username,password,database,table
    server = Request.Form("server")
    username = Request.Form("username")
    password = Request.Form("password")
    database = Request.Form("database")
    table = Request.Form("table")
    dim RS1
    set RS1 = Server.CreateObject( "ADODB.Connection" )
        RS1.Open "SELECT * FROM " & table & "", "server=" & server & ";UID=" & username & ";PWD=" & password & ";database=" & database & ";Provider=SQLOLEDB", 0, 1

    Response.ContentType = "text/csv"

    Response.AddHeader "Content-Disposition", "attachment;filename=export.csv"

    Write_CSV_From_Recordset RS1
  End If

What do I do wrong to get that error? Thank you!

1
  • 'be01v-sat' is the SQL Server name sent through POST. Commented Mar 8, 2012 at 9:39

1 Answer 1

1

Your usage of connection.open is invalid (looks like you have it confused with recordset.open) - try this:

If Request.ServerVariables("REQUEST_METHOD") = "POST" Then 
    dim server,username,password,database,table 
    strServer = Request.Form("server") 
    username = Request.Form("username") 
    password = Request.Form("password") 
    database = Request.Form("database") 
    table = Request.Form("table") 
    dim conn, rs
    set conn = Server.CreateObject( "ADODB.Connection" ) 
    set rs = Server.CreateObject( "ADODB.Recordset" ) 
    conn.Open "DRIVER={SQL Server};SERVER=" & strServer & ";DATABASE=" & database & ";UID=" & username & ";PWD=" & password, username, password
    set rs = conn.execute("SELECT * FROM " & table)

    Response.ContentType = "text/csv"
    Response.AddHeader "Content-Disposition", "attachment;filename=export.csv" 

    Write_CSV_From_Recordset rs
End If 
Sign up to request clarification or add additional context in comments.

6 Comments

Microsoft VBScript runtime error '800a01a8' Object required: 'be01v-sat' /CFIDE/csv.asp, line 90 Same...should I post all code?
Yes, make sure you post line 90
Line 90 on your source is set conn = Server.CreateObject( "ADODB.Connection" ) - I cant see any way that would cause the error you describe? sure you posted the correct source? can you give a better indication of what line 90 is (incase pastebin inserted extra line breaks)
Is the exact code I pasted to pastebin and gives me that strange error...If I send the connection details through POST I get the error, if I just insert the connection details in the code it works...
The actual error is happening on the line "conn.Open "DRIVER={SQL Server};SERVER=" & server & ";DATABASE=" & database & ";UID=" & username & ";PWD=" & password" in regard to POST variable "server = Request.Form("server")"
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.