Click here to Skip to main content
16,010,184 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Pointer to parent dialog. Pin
Christian Graus5-Jun-01 22:12
protectorChristian Graus5-Jun-01 22:12 
GeneralRe: Pointer to parent dialog. Pin
David Fleming6-Jun-01 23:43
David Fleming6-Jun-01 23:43 
GeneralProblem running SMTP as a WIN32 service Pin
Pramodh5-Jun-01 21:24
Pramodh5-Jun-01 21:24 
GeneralAuto Fill Html Forms/Fields Pin
5-Jun-01 20:09
suss5-Jun-01 20:09 
GeneralDisconnected Recordset Pin
yamini5-Jun-01 20:02
yamini5-Jun-01 20:02 
GeneralRe: Disconnected Recordset Pin
Mangesh Sardesai5-Jun-01 21:40
Mangesh Sardesai5-Jun-01 21:40 
GeneralRe: Disconnected Recordset Pin
yamini5-Jun-01 22:17
yamini5-Jun-01 22:17 
GeneralRe: Disconnected Recordset Pin
Mangesh Sardesai5-Jun-01 23:32
Mangesh Sardesai5-Jun-01 23:32 
I am a VB developer and hence using the VB terminology. So please bear with me.

The disconnected recordset did not worked with MS-ACCESS, the probable reason being,access being a file database, the file is closed as soon as the active connection of the recordset is set to nothing. This behaviour of the provider is be default and nothing can be done about it directly. (i.e. Set rs.ActiveConnection=Nothing wont work)

The only thing you can do is -
1. Return a connected recordset to client process (rs1).
2. Create a new Recordset in client process (rs2)
3. Add exactly similar number & type of fields to rs2 as in returned Recordset(rs1).
4. open recordset (rs2). without any connection or source.This should be dynamic
5. run a loop inside which you will add the records from rs1 to rs2
one at a time.
6. close rs1.
7. use rs2 as you wish

I have developed a small program in VB which you can refer & transpose to VC++.

The database is an access database with a single table "table1" with fields -

No Autonumber
Name Text(50)

===================================================
ActiveX dll
===================================================
Option Explicit
Dim conn As New ADODB.Connection
''''''''''''''''''''''''''''''''
Private Sub Class_Initialize()
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\1.mdb;Persist Security Info=False;"
End Sub

Public Function GetRsData() As ADODB.Recordset
Dim rs As New ADODB.Recordset
rs.Open "table1", conn, adOpenStatic, adLockReadOnly, adCmdTable
Set GetRsData = rs
End Function
========================================================================

========================================================================
The Client Executable
========================================================================
'A simple form with a single button placed & code for button click event
Private Sub Command1_Click()
Dim cls As New Class1
Dim rs1 As New ADODB.Recordset
Set rs1 = cls.GetRsData

Dim rs2 As New ADODB.Recordset
rs2.Fields.Append "No", adInteger
rs2.Fields.Append "Name", adVarChar, 50
rs2.Open "", , adOpenDynamic, adLockOptimistic, adCmdUnknown

Do Until rs1.EOF
rs2.AddNew
rs2("No").Value = rs1("No").Value
rs2("Name").Value = rs1("Name").Value
rs2.Update
rs1.MoveNext
Loop

rs1.Close
Set rs1 = Nothing

rs2.MoveFirst
Do Until rs2.EOF
MsgBox rs2(0) & " : " & rs2(1)
rs2.MoveNext
Loop
'If i halt the execution at this point and check for the active
'connection in debug window then it is found to be nothing.
'i.e ?rs2.ActiveConnection is nothing gives me TRUE!
'And there is your disconnected recordset(though not truely disconnected as it was never connected).
End Sub

I hope the above example would answer your query and help you in solving your problem.

do let me know if you get acheive any another solution.

regards,

Mangesh Sardesai.


GeneralRe: Disconnected Recordset Pin
yamini6-Jun-01 19:10
yamini6-Jun-01 19:10 
GeneralMMC Snapin Pin
5-Jun-01 17:02
suss5-Jun-01 17:02 
GeneralRe: MMC Snapin Pin
Igor Sukhov6-Jun-01 7:50
Igor Sukhov6-Jun-01 7:50 
Generalquestion about the X button of the title bar Pin
5-Jun-01 14:53
suss5-Jun-01 14:53 
GeneralRe: question about the X button of the title bar Pin
Michael Dunn5-Jun-01 16:40
sitebuilderMichael Dunn5-Jun-01 16:40 
GeneralRe: Check WindowProc function! Pin
Masaaki Onishi5-Jun-01 17:46
Masaaki Onishi5-Jun-01 17:46 
QuestionIs there any good class for Outlook-bar control ?? Pin
5-Jun-01 14:35
suss5-Jun-01 14:35 
AnswerRe: Is there any good class for Outlook-bar control ?? Pin
Ulf Öhlén5-Jun-01 20:48
Ulf Öhlén5-Jun-01 20:48 
Questionhow to call javascript functions from c++ Pin
5-Jun-01 12:27
suss5-Jun-01 12:27 
GeneralTabs on side, transparent dialog and disable radiobuttons Pin
Dennis Nilsson5-Jun-01 11:53
Dennis Nilsson5-Jun-01 11:53 
GeneralRe: Tabs on side, transparent dialog and disable radiobuttons Pin
Christian Graus5-Jun-01 13:03
protectorChristian Graus5-Jun-01 13:03 
GeneralChange font in Dialog Pin
5-Jun-01 10:54
suss5-Jun-01 10:54 
GeneralRe: Sure. Pin
Masaaki Onishi5-Jun-01 17:51
Masaaki Onishi5-Jun-01 17:51 
GeneralProblem with CMenu Pin
5-Jun-01 9:37
suss5-Jun-01 9:37 
GeneralProblem solved, new problem :) Pin
5-Jun-01 10:05
suss5-Jun-01 10:05 
GeneralRe: Problem solved, new problem :) Pin
5-Jun-01 15:10
suss5-Jun-01 15:10 
Generalproblem using Xalan in a COM component to be used in ASP Pin
joshua williams5-Jun-01 9:25
joshua williams5-Jun-01 9:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.