Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Move Methods


Message #1 by "Vibha Prajapati" <vprajapati@i...> on Wed, 6 Sep 2000 15:13:28 +0100
One other thing to try is to use the .Open method of a ADODB.Recordset
object to fetch your recordset in your Get_Table_Master method, rather than
Connection.Execute.  I'm pretty sure that recordsets opened with .Execute
are read-only, forward-only, regardless of the properties you can set to try
and change this.

HTH,

-Roy

-----Original Message-----
From: Kevin Stone [mailto:kstone@p...]
Sent: Wednesday, September 06, 2000 10:20 AM
To: professional vb
Subject: [pro_vb] RE: Move Methods


Vibha,
	Just glancing through your code, I noticed that you are using text
boxes to show your data.  Are these bound controls?  If not then either bind
them to the db or use a data control, or update the textboxes at each
command button event.

HTH
Kevin

-----Original Message-----
From: Vibha Prajapati [mailto:vprajapati@i...]
Sent: Wednesday, September 06, 2000 10:13 AM
To: professional vb
Subject: [pro_vb] Move Methods


Hi:
I have client application (Standard exe) and server application (ActiveX
DLL).  When i open my form the data is displayed from the access table on
the form.  But my MoveFirst, MoveLast, MovePrevious, MoveNext doesn't
work.  If i click the command button it goes to that logic but the same
record remains.  Do i need to use ActiveX Data Control instead of doing it
this way.  Is their any solution for this code.

Thank you,

Vibha

SOURCE CODE

'THIS IS MY CLIENT (STANDARD EXE)

clsServer is referenced in client

Option Explicit

Dim objServer As clsServer
Dim rsMasterTable As New Adodb.Recordset 'Recordset for Master Table
Dim rsStateTable As New Adodb.Recordset 'Recordset for state Table

Private Sub cmdFirst_Click()
rsMasterTable.MoveFirst
End Sub

Private Sub cmdLast_Click()
rsMasterTable.MoveLast
End Sub

Private Sub cmdNext_Click()
   If rsMasterTable.EOF = Not True Then
      rsMasterTable.MoveNext
   End If
End Sub

Private Sub cmdPrevious_Click()
   If rsMasterTable.BOF = Not True Then
      rsMasterTable.MovePrevious
   End If
End Sub

Private Sub Form_Load()

Set objServer = New clsServer

'call the function of middle tier component to populate the text box

Set rsMasterTable = objServer.Get_Table_Master()

txtSSN = rsMasterTable("M_SSN")
txtFirstName = rsMasterTable("M_FirstName")
txtLastName = rsMasterTable("M_LastName")
txtMiddleI = rsMasterTable("M_MiddleIntial")
txtBirthDate = rsMasterTable("M_BirthDate")
End Sub
---------------------------------------------------------------------------


'THIS IS MY SERVER APPLICATION (ACTIVEX DLL)

Option Explicit

Dim objConnection As ADODB.Connection
Dim rsMasterTable As New ADODB.Recordset 'Recordset for Master Table
Dim strSQL As String

Private Sub Class_Initialize()
    Set objConnection = New ADODB.Connection
    objConnection.ConnectionString = "DSN=PTS;uid=;pwd="
End Sub

'RUNS THE SQL AND LOAD THE DATA IN THE FORM
Public Function Get_Table_Master() As ADODB.Recordset
    objConnection.Open
    objConnection.CursorLocation = adUseClient
    'we need to pass the recordset to the client
    'serving the relationship with connection object
                                             
    
    strSQL = "SELECT * FROM [Master Table]"
    
    Set Get_Table_Master = objConnection.Execute(strSQL)
    
    Get_Table_Master.ActiveConnection = Nothing
    
    objConnection.Close
    
End Function


  Return to Index