views:

275

answers:

3

I am new to Powerbuilder.

I want to retrive the data from an MSAccess tables and update it to curresponding SQL tables.I am not able to create a permanent DSN for MSAccess because i have to select different MSAccess files with same table informations.I can create a permanent DSn for SQL server.

Please help me to create s DSN Dyanamically when selecting the MSAccess file and push all the tables data to SQL using powerbuilder.

Also give the full powerbuilder code to complete the problem if its possible.

A: 
  • Create the DSN manually in the ODBC administrator
  • Locate the entry in the registry
  • Export the registry syntax into a .reg file
  • Read and edit the .reg file dynamically in PB
  • Write it back to the registry using PB's RegistrySet ( key, valuename, valuetype, value )

Once you've got your DSN set up, there are many options to push data from one database to the other.

You'll need two transaction objects in PB, each pointing to its own database. Then, you could use a Data Pipeline object to manage the actual data transfer.

Vincent Buck
+4  A: 

In Access we strongly suggest not using DSNs at all as it is one less thing for someone to have to configure and one less thing for the users to screw up. Using DSN-Less Connections You should see if PowerBuilder has a similar option.

Tony Toews
DaveE
+1  A: 

You want to do the DSNLess connection referenced by Tony. I show an example of doing it at PBDJ and have a code sample over at Sybase's CodeXchange.

Bruce Armstrong