/*------------------------------------------------------------------------*/
/* */
/* Function: CheckSQLServerDSNInputValid */
/* */
/* Descrip: check the input data is valid. */
/* do not need to check the pwd if empty */
/* Misc: */
/* */
/*------------------------------------------------------------------------*/
function CheckSQLServerDSNInputValid(hwndDlg, bAllowNotSet)
STRING szDBUserName;
STRING szSQLDB;
STRING szSQLAddr;
STRING szSQLDSN;
begin
if(bAllowNotSet) then
_WinSubEnableControl(hwndDlg, SD_PBUT_CONTINUE, 1);
return 1;
endif;
if((CtrlGetState(DSN_SQLSERVER_DLG, IDC_RADIO_DSN_USER) = BUTTON_UNCHECKED) &&
(CtrlGetState(DSN_SQLSERVER_DLG, IDC_RADIO_DSN_SYSTEM) = BUTTON_UNCHECKED)) then
_WinSubEnableControl(hwndDlg, SD_PBUT_CONTINUE, 0);
return 0;
endif;
CtrlGetText(DSN_SQLSERVER_DLG, IDC_EDIT_SQLSERVER_USER_NAME, szDBUserName);
if(StrLength(szDBUserName) = 0) then
_WinSubEnableControl(hwndDlg, SD_PBUT_CONTINUE, 0);
return 0;
endif;
CtrlGetText(DSN_SQLSERVER_DLG, IDC_EDIT_SQLSERVER_DSN, szSQLDSN);
if(StrLength(szSQLDSN) = 0) then
_WinSubEnableControl(hwndDlg, SD_PBUT_CONTINUE, 0);
return 0;
else
if(!SQLValidDSN(szSQLDSN)) then
MessageBox("输入了无效的数据源名称!", INFORMATION);
_WinSubFocusControl(hwndDlg, IDC_EDIT_SQLSERVER_DSN);
return 0;
endif;
endif;
CtrlGetText(DSN_SQLSERVER_DLG, IDC_EDIT_SQLSERVER_DB, szSQLDB);
if(StrLength(szSQLDB) = 0) then
_WinSubEnableControl(hwndDlg, SD_PBUT_CONTINUE, 0);
return 0;
endif;
CtrlGetText(DSN_SQLSERVER_DLG, IDC_EDIT_DB_ADDR, szSQLAddr);
if(StrLength(szSQLAddr) = 0) then
_WinSubEnableControl(hwndDlg, SD_PBUT_CONTINUE, 0);
return 0;
endif;
_WinSubEnableControl(hwndDlg, SD_PBUT_CONTINUE, 1);
return 1;
end;
#endif // __KDCIS_RUL_