ASP.\/BScript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Shelbyoh
    New Member
    • May 2007
    • 2

    #1

    ASP.\/BScript

    Error Type:
    Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
    [Microsoft][ODBC SQL Server Driver][Shared Memory]ConnectionWrite (send()).

    1 <%@ Language=VBScri pt %>
    2 <%
    3 ' *************** *************** *************** *******
    4 ' ProdAddDept.asp - Adds a new product into a
    5 ' department.
    6 ' *************** *************** *************** *******
    7
    8 ' Create an ADO database connection
    9 set dbProdDept = server.createob ject("adodb.con nection")
    10
    11 ' Create the record set
    12 set rsProdDept = server.CreateOb ject("adodb.rec ordset")
    13
    14 ' Open the connection using our ODBC file DSN
    15 dbProdDept.open ("filedsn=rmsto re")
    16
    17 ' Execute the sp_AddProdDept stored procedure to
    18 ' tie together the product and the department
    19 sql = "execute sp_AddProdDept " & _
    20 request("idProd uct") & ", " & _
    21 request("idDepa rtment")
    22
    23 ' Execute the statement
    24 set rsProdDept = dbProdDept.Exec ute(sql)
    25
    26 ' Send the user back to the manageproduct.a sp page
    27 Response.Redire ct "ManageProduct. asp?idProduct=" & _
    28 request("idProd uct")
    29
    30 %>
  • dthompson
    New Member
    • May 2007
    • 8

    #2
    Originally posted by Shelbyoh
    Error Type:
    Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
    [Microsoft][ODBC SQL Server Driver][Shared Memory]ConnectionWrite (send()).

    1 <%@ Language=VBScri pt %>
    2 <%
    3 ' *************** *************** *************** *******
    4 ' ProdAddDept.asp - Adds a new product into a
    5 ' department.
    6 ' *************** *************** *************** *******
    7
    8 ' Create an ADO database connection
    9 set dbProdDept = server.createob ject("adodb.con nection")
    10
    11 ' Create the record set
    12 set rsProdDept = server.CreateOb ject("adodb.rec ordset")
    13
    14 ' Open the connection using our ODBC file DSN
    15 dbProdDept.open ("filedsn=rmsto re")
    16
    17 ' Execute the sp_AddProdDept stored procedure to
    18 ' tie together the product and the department
    19 sql = "execute sp_AddProdDept " & _
    20 request("idProd uct") & ", " & _
    21 request("idDepa rtment")
    22
    23 ' Execute the statement
    24 set rsProdDept = dbProdDept.Exec ute(sql)
    25
    26 ' Send the user back to the manageproduct.a sp page
    27 Response.Redire ct "ManageProduct. asp?idProduct=" & _
    28 request("idProd uct")
    29
    30 %>
    I can really tell where you problem lies, I don't normally use a predefined ODBC connection, I prefer to create a connection eg.
    set con = Server.CreateOb ject("ADODB.Con nection")
    set Main = Server.CreateOb ject("ADODB.Rec ordset")
    con.ConnectionS tring="DSN=loca lserver;Trusted _Connection=Yes ;Database=DBNAM E;"
    Con.Open

    sticking with the above code, to run a query, sp, etc.
    Main.Open "Select * From Player order by pname desc", Con

    I have seen the syntax you used before, but it hasn't brought me much success, I therefor use the above line to execute SQL commands.
    set rsProdDept = dbProdDept.Exec ute(sql)

    Hope this helps, alas without more information it is hard to diagnose

    Comment

    Working...