Click here to Skip to main content
15,894,896 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
real Sever : Window Server 2003 , DB Oracle 9i

local Server : Window7 64bit , DB Oracle 11g client 32bit

----------------------------------------------
## real Sever Source.
----------------------------------------------
C#
Set Conn=Server.CreateObject("ADODB.Connection")

  Conn.open "Provider=MSDAORA.1;Data Source=CS_TEST.world;User Id=trnusr;Password=trnusr0515"

  SQL = "Select store_cd, store_kor_nm from MSTADM.CSMST09TB"

  Set Rs = Server.CreateObject("ADODB.Recordset"")

  set rs       = createobject("adodb.recordset"")
    set rsCmd  = createobject("adodb.Command"")
    set rsCODE = createobject("adodb.Parameter"")

    rsCmd.ActiveConnection = conn.connectionstring <==== here!!!!
    rsCmd.CommandType = 1
    rsCmd.CommandText = SQL

    set rs      = rsCmd.execute
    set rsCmd   = nothing
    set rsCODE = nothing

  If conn.errors.count = 0 Then

    Response.Write("OK")

else
    Response.Write(conn.errors(0).description)
    Response.Write(conn.connectionstring)

    End If
------------------------------------------------------------------
## To local server
------------------------------------------------------------------
rsCmd.ActiveConnection = conn.connectionstring => not working
rsCmd.ActiveConnection = conn => working

what's problem?

I hope the solution, please!!
Thank you!!
Posted
Updated 22-Oct-14 1:49am
v2
Comments
What is the issue? Have you debugged?
Member 10923970 22-Oct-14 5:03am    
I want to make environment for development.
So Copy to local pc from Real-Sever Source.
But The Source is not working at local pc.
=> rsCmd.ActiveConnection = conn.connectionstring (Original)

Sot I repaired it. ( rsCmd.ActiveConnection = conn )
And then it's working.

I want to know the reason.
The system OS is different?

Thank you.

1 solution

Quote:
I want to make environment for development.
So Copy to local pc from Real-Sever Source.
But The Source is not working at local pc.
=> rsCmd.ActiveConnection = conn.connectionstring (Original)

Sot I repaired it. ( rsCmd.ActiveConnection = conn )
And then it's working.

I want to know the reason.
Refer - ActiveConnection Property (ADO). ActiveConnection takes a Connection object, not a string. As conn.connectionstring is a string, so it does not work. It worked with conn, because it is a Connection Object.
 
Share this answer
 
Comments
Maciej Los 22-Oct-14 9:33am    
+5!
Thanks Maciej. :)
Member 10923970 22-Oct-14 20:52pm    
Thank you for your answer.

If Your answer is right,
' rsCmd.ActiveConnection = "Provider=MSDAORA.1;Data Source=CS_TEST.world;User Id=trnusr;Password=trnusr0515" ' this syntax is not working. But it's working in local pc.

AND ' rsCmd.ActiveConnection = conn.connectionstring ' This syntax is working in real server.

Thank you again!
See http://msdn.microsoft.com/en-us/library/windows/desktop/ms680972(v=vs.85).aspx for for information. You should always assign one Connection Object, not a string.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900