sybase - How do you create an ADODB disconnected recordset in a VB.NET Windows application? -
I have a Sybase database using an OLEDB connection, ADODB.dll file version 7kl0k6070k0 (which comes from Sybase 12.5 package) I need to be able to open a connection, use a command object to fill a collection object with the stored procedure, then close the connection and pass the disconnected record set back. Every time I close the connection, my attempt fails, my record sets also stop (which means that it has not been disconnected).
Should I set it anywhere to know that the record set should be disconnected? I can not set Recorsetset Active connections = wrong because I get an exception ( "can not change the active control properties of an active object of a Rikorset object that has a Command object as its source."). I set the command. Active connection = false, but as soon as I turn the connection object off, the recorder is not stopped by closing.
Snippet:
Dim conn As New ADODB.Connection () as conn.Open ( "connectionString", "UserID", "password") Dim New ADODB Set some parameters to the command () command. cmd.ActiveConnection = Conn cmd.CommandText = "StoredProcedureName" cmd.CommandType = ADODB.CommandTypeEnum.adCmdStoredProc dim New ADODB.Recordset () as rs.Open (cmd) ADODB.Recordset = rs.Clone as dim clonedRS ( ) Rs 'A) does not stop clone recordset cmd.ActiveConnection = nothing is' try another disconnected recordset conn.Close (try another disconnect); (try to disconnect recordset rs.Close (sadly, it is now closed) has "always gives recordset, even off clone clonedRS a refund 'do.
I do not know if this is your Ink will solve, but I came across a Google search and this article which you might be able to use to modify your code is as follows:
Slow New ADODB.Connection () Conn.Open ("ConnectionString", "UserID", "Password") as Conn. Set the few dimensions on the dim cmd () command as the new ADD. Command Cmd.ActiveConnection = conn cmd .CommandText = "StoredProcedureName" cmd.CommandType = ADODB.CommandTypeEnum.adCmdStoredProc dim rs as ADODB.Recordset with Rs. Cursor location = adUseClient Open cmd, type the cursor: = adOpenStatic, option: = adCmdStoredProc set. Active connection = nothing is dim clonedRS as ADODB.Recordset = RS cmd set = nothing ends with conn.Close () rs.Close () Set Conn = nothing set RS = nothing is returned clonedRS < / Example> Another example is 4GuysFromRolla. Edit The example fleshed out.
Comments
Post a Comment