Database Connection Issue

rajaselvam26

New Member
Hi All,


I am creating a UserCreation.p file, from that file I am trying to connect the Database. But I cant able to do that. At that time I am getting the Following Error.

Unknown or ambiguous table TBL_TENANT. (725)
** Could not understand line 18. (196)

Below is my Code :

DEFINE INPUT PARAMETER i_TenantName AS CHARACTER NO-UNDO.
DEFINE INPUT PARAMETER i_UserName AS CHARACTER NO-UNDO.

DEFINE VARIABLE tenantID AS INTEGER NO-UNDO.

/* check database connections */
IF NOT CONNECTED ("sports2000") THEN DO:
MESSAGE "Database sports2000 is not connected!"
VIEW-AS ALERT-BOX ERROR.
RETURN .
END.

FIND TBL_TENANT
WHERE TENANT_NAME = i_TenantName.

IF AVAILABLE(TBL_TENANT) THEN
DO:
tenantID = TBL_TENANT.TENANT_ID.

DEFINE VARIABLE currentCust AS INTEGER.
currentCust = NEXT-VALUE(sports2000.NextCustNum).

CREATE sports2000.C_USER.
ASSIGN C_USER.U_ID = currentCust
C_USER.U_NAME = i_UserName
C_USER.U_STATUS = 1
C_USER.U_TENANT_ID = tenantID NO-ERROR.

RETURN "SUCCESS!".
END.


Please help me.

- Rajaselvam.M
 

parul

Member
TBL_TENANT Is not usually part of sports2000 database.
Are you sure you have create a new table in the database and commited the changes?
 

rajaselvam26

New Member
Parul,

I had already created table in the name of TBL_TENANT in Sports2000 db.

and Even I tred with the Following Code:

/* check database connections */
IF NOT CONNECTED ("sports2000") THEN DO:
MESSAGE "Database sports2000 is not connected!"
VIEW-AS ALERT-BOX ERROR.
RETURN .
END.

At this time itself I got error Message as Database sports2000 is not connected!



-Rajaselvam.M
 

jongpau

Member
Easy; connect the database in a.p, then run the b.p (from a.p) and in b.p you can access the database you just connected - it is pretty well documented in the online help :)
 
Top