How VB Implements the Disonnected Architecture as like VB.Net?

Questions by srinivasan111

Showing Answers 1 - 5 of 5 Answers

Leo

  • Apr 15th, 2006
 

Well by intorducing a conceot called dataset.....which lies between database and datagrid or whatever ...your component is ....

  Was this answer useful?  Yes

kanwal_hans

  • Jun 17th, 2006
 

In VB to implement a disconnected recordset, after you have filled the recordset with the data, set its active connection property to "Nothing". That breaks the connection to the database.You can locally also save the data of the recordset by using its Save function.

  Was this answer useful?  Yes

You can implement Disconnected architecture by changing the cursor location property of Recordset to 3 (adUseClient)Set myRS = new ADODB.RecordsetmyRS.CursorLocation = adUseClientThis recordset is used as a disconnected recordset. That means, when you open the recordset with a query, the records are fetched into it. Then you need to set the active connection to nothing which means the recordset is disconnected. Below is an exampleDim myConn As ADODB.myConnectionDim myRs As ADODB.Recordset' Create instance of myConnection object and then open the' myConnection.Set myConn = New ADODB.myConnectionmyConn.Open "DSN=SQLServer", "sa", ""' Create instance of recordset object and open the' recordset object against a table.Set myRs = New ADODB.Recordset' Setting the cursor location to client side is important' to get a dismyConnected recordset.myRs.CursorLocation = adUseClientmyRs.Open "Select * from Table1", _ myConn, _ ADODB.adOpenForwardOnly, _ ADODB.adLockBatchOptimistic' DismyConnect the recordset.Set myRs.ActivemyConnection = Nothing' Get the value of one of the fields from the recordset' after dismyConnection.Dim vv = myRs.Fields(0).ValueMsgBox vmyConn.Close' Get the value of one of the fields from the recordset' after closing the myConnection to ensure that you have a' dismyConnected recordset.v = myRs.Fields(0).ValueMsgBox (v)' Now edit the value and save it.myRs.Fields("au_lname").Value = "NewValue"' Now reopen the myConnection and attach it to the recordset. UpdateSet myConn = New ADODB.myConnectionmyConn.Open "DSN=DBSql", "sa", ""myRs.ActivemyConnection = myConnmyRs.UpdateBatchmyRs.ClosemyConn.CloseSet myRs = NothingSet myConn = Nothing

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions