Jump to content
We've recently updated our Privacy Statement, available here. ×

Recover SQL string from a previous DatabaseDataSourceSettings


Janine Rawnsley 4

Recommended Posts

Hello

When we useDatabaseDataSourceSettings to create a new DatabaseDataSource, how might we get these settings again in future from the created data table

I need to be able to retrieve the SQL to inject a WHERE / remove the WHERE dynamically.

e.g.

tableName = "theTable"

connString = "Dsn=MyDSN;Uid=111;Pwd=222";

# Dynamic SQL here...

sql = "SELECT * FROM someTablelimit 100;"

dbSettings=DatabaseDataSourceSettings("System.Data.Odbc",connString,sql,True)

ds=DatabaseDataSource(dbSettings)

 

dt = getDataTable(tableName);

if dt != None:

# Table exists already

print "Replacing table..."

dt.ReplaceData(ds)

 

dtds = DataTableDataSource(dt)

print dtds.Name

print dtds.Settings.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...