Results 1 to 2 of 2

Thread: dataset problem

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2007
    Posts
    5

    dataset problem

    hi all

    I fill my dataset from two different databases using odbc and sql adapter. But i need to update my parodox table data with data from sql table.

    which way o method i need to use . i have no idea

    my code to load data works and returns result
    vb.net Code:
    1. ' load data to dataset
    2.  Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
    3.         Dim s As String
    4.         s = "DRIVER=Microsoft Access Paradox Driver (*.db);UID=admin;" & _
    5.             "UserCommitSync=Yes;Threads=3;SafeTransactions=0;ParadoxUserName=admin;ParadoxNetStyle=4.x;Paradox;" & _
    6.             "NetPath={0};" & _
    7.             "PageTimeout=600;MaxScanRows=8;MaxBufferSize=2048;" & _
    8.             "FIL=Paradox 5.X;DriverId=538;" & _
    9.             "DefaultDir={0};" & _
    10.             "DBQ={0};" & _
    11.             "CollatingSequence=ASCII"
    12.              s = "FILEDSN=paradox.dsn"
    13.         Dim c As String
    14.         c = "server=serveris;user id=sa;password=mypsw;Database=database"
    15.         Dim sSQL As String
    16.         Dim d As New DataSet()
    17.         Dim f As New DataSet()
    18.         ' Load the target data and name the table
    19.         Dim oConn = GetNewConnection()
    20.         sSQL = "SELECT f1,f2  FROM  test1;"
    21.  
    22.         Dim adapter As Odbc.OdbcDataAdapter
    23.         adapter = New Odbc.OdbcDataAdapter(sSQL, s)
    24.         adapter.TableMappings.Add("table", "test1")
    25.         d = New DataSet()
    26.         adapter.Fill(d, "test1")
    27.         d.AcceptChanges()
    28.         ' Load the source data, set table name and PK
    29.         Dim cSQL As String
    30.         ' Create and open a new connection to local backup MDB
    31.         Dim Conn = GetNewConnectionSQL()
    32.         cSQL = "SELECT f1,f2  FROM test2;"
    33.         Dim cadapter As SqlClient.SqlDataAdapter
    34.         cadapter = New SqlClient.SqlDataAdapter(cSQL, c)
    35.         cadapter.TableMappings.Add("table", "test2")
    36.         f = New DataSet()
    37.         cadapter.Fill(f, "test2")
    38.        d.Merge(f)
    39.         datagrid.DataSource = d
    40.  
    41.            End Sub
    What can i do to save data from test 2 to test1 table ?? please give direction
    Thanks .
    Last edited by Hack; Oct 19th, 2007 at 08:53 AM. Reason: Added Highlight Tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width