博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

增加数据源后VB脚本的改动

Posted on 2006-04-15 14:31  智岛软件  阅读(251)  评论(0编辑  收藏  举报

1.窗体不再单独对应于一个数据表;

2.一个窗体可对应多个数据源,每输入控件(如编辑框等)都要对应一个数据源;

3.DBEngine的很多函数增加了数据源参数(LPCTSTR strDataSource),如下列表:
 afx_msg BOOL FirstRecord(LPCTSTR strDataSource);
 afx_msg BOOL NextRecord(LPCTSTR strDataSource);
 afx_msg BOOL PrevRecord(LPCTSTR strDataSource);
 afx_msg BOOL LastRecord(LPCTSTR strDataSource);
 afx_msg BOOL NewRecord(LPCTSTR strDataSource);
 afx_msg BOOL SaveRecord(LPCTSTR strDataSource);
 afx_msg BOOL DeleteRecord(LPCTSTR strDataSource);
 afx_msg void SetReadOnly(LPCTSTR strDataSource, BOOL bValue);
 afx_msg BOOL GetReadOnly(LPCTSTR strDataSource);
 afx_msg BOOL GoToRecord(LPCTSTR strDataSource, long nIndex);
 afx_msg BOOL SetXMLFieldValue(LPCTSTR strDataSource, LPCTSTR strXML);
 afx_msg BOOL IsModified(LPCTSTR strDataSource);
 afx_msg void FillData(LPCTSTR strDataSource, LPCTSTR strXML);
 afx_msg void AddKeyName(LPCTSTR strDataSource, LPCTSTR strKeyName);
 afx_msg BSTR GetKeyNameAt(LPCTSTR strDataSource, short nIndex);
 afx_msg void SetKeyValue(LPCTSTR strDataSource, LPCTSTR strKeyName, LPCTSTR strKeyValue);
 afx_msg BSTR GetKeyValue(LPCTSTR strDataSource, LPCTSTR strKeyName);
 afx_msg void EmptyKeyValue(LPCTSTR strDataSource);
 afx_msg void SetPrimaryKey(LPCTSTR strDataSource, LPCTSTR strPrimaryKey);
 afx_msg BSTR GetPrimaryKey(LPCTSTR strDataSource);
 afx_msg BSTR GetCurRecordSQLWhere(LPCTSTR strDataSource);
 afx_msg void SetCurRecordSQLWhere(LPCTSTR strDataSource, LPCTSTR strSQLWhere);
 afx_msg BOOL LocateRecordBySQLWhere(LPCTSTR strDataSource, LPCTSTR strSQLWhere);
 afx_msg void SetFilterSQLWhere(LPCTSTR strDataSource, LPCTSTR strSQLWhere);
 afx_msg BSTR GetFilterSQLWhere(LPCTSTR strDataSource);
 afx_msg void ReflashCurRecord(LPCTSTR strDataSource);
 afx_msg long GetCurIndex(LPCTSTR strDataSource);
 afx_msg BOOL IsNewRecord(LPCTSTR strDataSource);


4.不需要设置窗口的类型
    DBEngine.WindowType = 1 '设置为查询窗体类型1

5.删除了
 strTableName = DBEngine.TableName'窗口对应的数据表名称
  代码,如脚本要用到strTableName变量,则可在前面添加 strTableName = "数据表名称" ,如 strTableName = "学生基本信息表"
 
6.CurIndex属性改为有BOOL SetCurIndex(LPCTSTR strDataSource, long nIndex) 和long GetCurIndex(LPCTSTR strDataSource)
'响应网络当前行改变事件
Sub DBGrid14_EventCurRowChanged(nRowIndex)
'改变数据引擎的当前记录
 if DBEngine.GetCurIndex("家庭成员及社会关系") <> nRowIndex-DBGrid14.GetFixedRowCount then
   call DBEngine.GoToRecord("家庭成员及社会关系", nRowIndex-DBGrid14.GetFixedRowCount())
 End If
End Sub