//**********************************************
// Filename:	ODBC.OGS
// Creation:	8/3/00 by CPY
// Copyright (c) OriginLab Corporation 1992-2000
// Purpose:	ODBC related data import labtalk scripts
//**********************************************
// Modification Log:
//	CPY v6.1017 t8293 8/3/00 MOVE_ODBC_TO_SEPARATE_OGS_FILE, copy from file.ogs
//	LY  QA70-414 1/18/02 MOVE_HIDE_TEXT_OBJECT_TO_C_CODE
//

/////////////////////////////////////////////////////////
// Open DataBase Connectivity (ODBC)
/////////////////////////////////////////////////////////
[Import]

	//Calls to this section can only be made when a worksheet is active

	dll -a db odbc60;
	err=db.loadsql();
	
	//HYYU v4.962	4/8/97 CONSIDER_CANCEL_FOR_ODBC
	err=db.editsql();
	if(err!=0)
	   return 1;
	
	db.savesql();
	//LY  QA70-414 1/18/02 MOVE_HIDE_TEXT_OBJECT_TO_C_CODE
	//sql1.show=0;

	// All set at this point, now import
	///HYYU v4.9985	7/9/97 t2646 KEEP_COLUMN_SPECIFICATIONS_FOR_ODBC_INPUT
	///repeat wks.ncols {del col(1)};
	clearworksheet %H;
	db.getcolslist();
	begin=db.dbcolcount;
	end=wks.ncols;
	repeat (end-begin) {delete %(%H,wks.ncols)};
	///end KEEP_COLUMN_SPECIFICATIONS_FOR_ODBC_INPUT
	db.wksname$=%H;
	db.open();
	db.autosetcol=1;
	db.read.autoaddcol=1;
	db.read(0);
	db.close();
	//LY  QA70-414 1/18/02 MOVE_HIDE_TEXT_OBJECT_TO_C_CODE
	//sql1.show=0;
	///HYYU show database name
	///HYYU show table name
	%A=db.dbpath$;
	%B=" : ";
	%A=%A%B;
	%B=db.dbtable$;
	%A="%A%B";
	page.label$="%A";
	///page.label$=db.dbpath$;
	page.title=3;
	///end show title
	//HYYU change to correct method
	//wks.label();
	wks.labels();
	return 0;

