We help IT Professionals succeed at work.

Multiple database connections in one DataWindow Control

DrVannacult
DrVannacult asked
on
Hi all experts,

*I assume that 1st connection = Default connection (active connection)*

In my window object (name="w_update"), I has one DataWindow Control (use 2nd connection : "trans_list" : name="dw_con_list") that some column in this DataWindow Object I have set it to Editable with "DropDownDW" and point to "dw_customer" object (This object use Default connection : SQLCA). Then problem is occurred... In "w_update"'s "open" event, I have these code in

//Begin here
Transaction trans_list

trans_list = create Transaction

trans_list.dbms = "ODBC"
trans_list.autocommit = true
trans_list.dbparm = "ConnectString='DSN=eCM;UID=;PWD='"

CONNECT USING trans_list;

dw_con_list.SetTransObject(trans_list)
dw_con_list.Retrieve()
//End...

When I open the window then PB warn me...

(DataWindow Error)
Select Error : SQLState=S0002
Microsoft Jet Database Engine can not find the input table or query 'table_name'. Make sure it exists and spell correctly.

*In design time I can't retrieve all DataWindow object that use 2nd Connection, But In runtime I have created transaction object and SetTransObject() then It'll work fine. Can someone tell me that I'm going the right way? or wrong way?*

Can someone plz point me to the solution to solve all my confusing/suspecting...

Thanks very much & very much all experts,
Here is my only one hope.
8)

DrVannacult
Comment
Watch Question

Commented:
Please goto the datawindow modify propertiy and look your select statement from convert to syntax menu and look your select statement and correct it if neccessary.

Check also the tables exist in the database you are connecting and name of the tables, if you are using them in your select statement.


Please let me know after this check.

Bhatti

Author

Commented:
Hi Bhatti,

I've checked and I thinks that my SELECT SQL is right and the table name also.

I'm sure my SELECT SQL is right. But the problem I found is that my 1st DataWindow object is using Default Connection but my 2nd DataWindow is using Another Connection. So when I'm designing the 2nd DataWindow object then I can't retrieve() in 1st DataWindow. But when the program is running. It works fine ('Cause I've created Transaction object for each Connection). So I thinks that It'll works fine If I've SetTransObject() for the DataWindow objects but I don't know how to do that in my case(a DataWindow with another DataWindow within(by DropDownDW)).

Maybe I'm going to the wrong way. So I'll tell u my objective in my working.

Objective: Want the simple master-datawindow that editable but in some field editing I want to listing all choice to let user choose, and all of the choice is stored in another Database (Not in master-datawindow's Database). So I decide to use DropDownDW but the problem is the Database isn't the same one.

Plz help a newbie!
Thanks very much,
Thanks u much Bhatti, who always help me
8)

DrVannacult
Commented:
Use the GetChild().

datawindowchild      ldwc_child

dw_master.GetChild("columnname", ldwc_child)
ldwc_child.SetTransObject(yourtransaction_for_database)
ldwc_child.Retrieve()


It should work.


Bhatti

Author

Commented:
OMG!!!
This works fine for me!
Thanks you very much, Bhatti
8D

Thanks again yah!

I'm going into next stage of PB. Thanks!

DrVannacult

Author

Commented:
Works Fine!!!!!!!!
Thanks much

Explore More ContentExplore courses, solutions, and other research materials related to this topic.