I try connect Citect 7 ODBC Excel..
STRING FUNCTION getCoilSelect()
INT hSQL;
STRING sName;
INT Status;
hSQL = SQLConnect("Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=d:\somepath\coil_data.xls;DefaultDir=d:\somepath");
IF hSQL <> -1 THEN
Status = SQLExec(hSQL, "SELECT ThickNess FROM [sheet$]");
IF Status = 0 THEN
WHILE SQLNext(hSQL) = 0 DO
sName = SQLGetField(hSQL, "ThickNess");
SQLEnd(hSQL);
END
ELSE
Message("Error", SQLErrMsg(), 48);
END
SQLDisconnect(hSQL);
ELSE
Message("Error", SQLErrMsg(), 48);
END
RETURN sName;
END
("Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=d:\somepath\coil_data.xls;DefaultDir=d:\somepath"
This is to use a DSN-less connection string to connect to the database and using UNC path in the connection string when using SQLConnect().
What is wrong?
STRING FUNCTION getCoilSelect()
INT hSQL;
STRING sName;
INT Status;
hSQL = SQLConnect("Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=d:\somepath\coil_data.xls;DefaultDir=d:\somepath");
IF hSQL <> -1 THEN
Status = SQLExec(hSQL, "SELECT ThickNess FROM [sheet$]");
IF Status = 0 THEN
WHILE SQLNext(hSQL) = 0 DO
sName = SQLGetField(hSQL, "ThickNess");
SQLEnd(hSQL);
END
ELSE
Message("Error", SQLErrMsg(), 48);
END
SQLDisconnect(hSQL);
ELSE
Message("Error", SQLErrMsg(), 48);
END
RETURN sName;
END
("Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=d:\somepath\coil_data.xls;DefaultDir=d:\somepath"
This is to use a DSN-less connection string to connect to the database and using UNC path in the connection string when using SQLConnect().
What is wrong?
Last edited: