Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
| Search | Today's Posts | Mark Forums Read
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 22nd, 2004, 05:28 AM
Registered User
 
Join Date: Oct 2003
Location: Cornwall, Cornwall, United Kingdom.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: SQL Server dataset to ACCESS dataset

I need to grab data from table tblClub of a SQL Server db and copy it to table tblClub of an ACCESS db.

I have the following piece of code which calls an onclick event to
grab data into dataset of the Server db then delete all in LOCAL before filling the LOCAL dataset with the SERVER dataset.

I then use the .update property which should update the LOCAL database.

My problem is that it is not updating the LOCAL database. Can anyone help?

Dazzer

The code......

Private Sub btnDownloadAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDownloadAll.Click

        'Lets assign for Server table and row objects
        Dim objTableSQL As DataTable
        Dim objRowSQL As DataRow

        'Lets assign for Local table and row objects
        Dim objTableLOCAL As DataTable
        Dim objRowLOCAL As DataRow
        Dim objDR As Data.DataRow

        'Local Variables
        Dim theRow As Integer
        Dim theCol As String
        Dim intCounter As Integer
        Dim intColCounter As Integer

        'Error Handler - to catch a broken db Connection Path
        Try
            objLocalConn.Open()
            'This code will delete all from local table for a fresh insert
            Dim strSQL As String = "DELETE * FROM tblClub"
            Dim cmd As New System.Data.OleDb.OleDbCommand(strSQL, objLocalConn)
            cmd.ExecuteNonQuery()
        Catch obj2 As Exception
            MessageBox.Show(obj2.ToString())
        Finally
            objServerConn.Close()
        End Try

        'Grab from the DataSet
        objTableSQL = objDSServer.Tables("tblClub")
        objTableLOCAL = objDSLocal.Tables("tblClub")

        'Clear and Fill the Data Adapter
        'objDSLocal.Clear()
        objDALocal.Fill(objDSServer)
        objDAServer.Fill(objDSLocal)

        Try
            objDALocal.Update(objDSLocal, "tblClub")
        Catch q As Exception
            MessageBox.Show(q.ToString())
        End Try


        'objDAServer.Update(objDSLocal, "tblClub")
        objLocalConn.Close()
        objServerConn.Close()

        'Update the Datasource with the DataSet

        'Update the database
        'objDSLocal.Clear()
        'objDALocal.Fill(objDSLocal)

        'Next
        MessageBox.Show("Download from Server is Complete")

    End Sub






Similar Threads
Thread Thread Starter Forum Replies Last Post
Using SQL together with DataSet? jacob C# 5 August 12th, 2008 02:25 AM
Deleting the last dataset of a sql server database DarkForce ASP.NET 2.0 Basics 0 September 19th, 2007 05:06 AM
Fill(dataset) or dataset.load() salemkoten SQL Server 2005 1 November 2nd, 2006 11:04 PM
Converting a untyped dataset to a typed dataset daphnean Visual Studio 2005 0 July 13th, 2006 01:16 AM
dataset from the client to the server anin .NET Web Services 3 June 1st, 2005 11:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.