TableLogOnInfos.Add 方法
加入 TableLogOnInfo 物件至集合。
[Visual Basic]
Public Overridable Function Add(ByVal logOnInfo As Object) As Integer
[C#]
public virtual int Add (object logOnInfo );
[C++]
public virtual int Add (object * logOnInfo );
[VJ#]
public int Add (object logOnInfo );
參數
- tableLogOnInfo
加入至 TableLogOnInfos 集合的 TableLogOnInfo 物件。
傳回值
指出 TableLogOnInfo 在集合中的位置。
註解
TableLogOnInfos 集合必須包含報表中所有資料表的 TableLogOnInfo 物件。這是為了確保引擎能夠與所有資料表進行連接。如果無法建立連接,那麼就會顯示登入對話。
範例
這個範例示範如何將 TableLogOnInfo 物件加入 TableLogOnInfos 集合。這個函式是由連接資訊和 TableLogOnInfos 集合所組成,並會以加入的資訊傳回 TableLogOnInfos 集合。
[Visual Basic]
Private Function AddLogOnInfo(ByVal server As String, ByVal _ database As String, ByVal userID As String, ByVal password As _ String, ByVal table As String, ByVal LogOnInfos As _ TableLogOnInfos) As TableLogOnInfos
Dim logOnInfo As New TableLogOnInfo()
' 為報表中的資料表設定連接資訊。
logOnInfo.ConnectionInfo.ServerName = server
logOnInfo.ConnectionInfo.DatabaseName = database
logOnInfo.ConnectionInfo.UserID = userID
logOnInfo.ConnectionInfo.Password = password
logOnInfo.TableName = table
' 將 logoninfo 加入 logOnInfos 集合。
tableLogOnInfos.Add(logOnInfo)
AddLogOnInfo = tableLogOnInfos
End Function
[C#]
private TableLogOnInfos AddLogOnInfo
(string server, string database, string userID, string
password, string table, TableLogOnInfos tableLogOnInfos)
{
TableLogOnInfo logOnInfo = new TableLogOnInfo ();
// 為報表中的資料表設定連接資訊。
logOnInfo.ConnectionInfo.ServerName = server;
logOnInfo.ConnectionInfo.DatabaseName = database;
logOnInfo.ConnectionInfo.UserID = userID;
logOnInfo.ConnectionInfo.Password = password;
logOnInfo.TableName = table;
// 將 logoninfo 加入 logOnInfos 集合。
tableLogOnInfos.Add (logOnInfo);
return tableLogOnInfos;
}
[C++]
static TableLogOnInfos* AddLogOnInfo
(String* server, String* database, String* userID, String*
password, String* table, TableLogOnInfos* tableLogOnInfos)
{
TableLogOnInfo* logOnInfo = new TableLogOnInfo ();
// 為報表中的資料表設定連接資訊。
logOnInfo->ConnectionInfo->ServerName = server;
logOnInfo->ConnectionInfo->DatabaseName = database;
logOnInfo->ConnectionInfo->UserID = userID;
logOnInfo->ConnectionInfo->Password = password;
logOnInfo->TableName = table;
// 將 logoninfo 加入 logOnInfos 集合。
tableLogOnInfos->Add (logOnInfo);
return tableLogOnInfos;
};
[VJ#]
private TableLogOnInfos AddLogOnInfo
(String server, String database, String userID, String
password, String table, TableLogOnInfos tableLogOnInfos)
{
TableLogOnInfo logOnInfo = new TableLogOnInfo ();
// 為報表中的資料表設定連接資訊。
logOnInfo.get_ConnectionInfo().set_ServerName(server);
logOnInfo.get_ConnectionInfo().set_DatabaseName(database);
logOnInfo.get_ConnectionInfo().set_UserID(userID);
logOnInfo.get_ConnectionInfo().set_Password(password);
logOnInfo.set_TableName(table);
// 將 logoninfo 加入 logOnInfos 集合。
tableLogOnInfos.Add (logOnInfo);
return tableLogOnInfos;
}
需求
**平台:**Windows 98、Windows NT 4.0、Windows Millennium Edition、Windows 2000
請參閱
TableLogOnInfos 類別 | TableLogOnInfos 成員 | CrystalDecisions.Shared 命名空間