2017-04-14 11 views
0

こんにちはC#プログラムに関する質問があります.C#ソフトウェアでCrystalレポートを印刷する必要があります。私の問題は印刷を行うときにCrystalレポートがデータベースのログインパラメータを尋ねます。私はこれを無効にする?ありがとうCrystal Report askデータベースパラメータログインC#

私はコードの絵を入れて下にし、エラー

コードとエラー:

enter image description here

Errore 2方法:

enter image description here

答えて

1

つかいます SetDatabaseLogon機能

Myreport.SetDatabaseLogon("username", "password", "server", "dbname", false); 

SetDatabaseLogon機能が動作しない場合は...手動で第二の方法は私を与えるといつも、私のパラメータを尋ねる最初の方法で、その後の報告

ConnectionInfo connInfo = new ConnectionInfo(); 
connInfo.ServerName = "Driver={Adaptive Server  Enterprise};Server=x.x.x.x;Port=x;"; 
connInfo.UserID = "username"; 
connInfo.Password = "password"; 
TableLogOnInfo tableLogOnInfo = new TableLogOnInfo(); 
tableLogOnInfo.ConnectionInfo = connInfo; 
foreach(Table table in reportDoc.Database.Tables) 
{ 
    table.ApplyLogOnInfo(tableLogOnInfo); 
    table.LogOnInfo.ConnectionInfo.ServerName =  connInfo.ServerName; 
    table.LogOnInfo.ConnectionInfo.DatabaseName =  connInfo.DatabaseName; 
    table.LogOnInfo.ConnectionInfo.UserID = connInfo.UserID; 
    table.LogOnInfo.ConnectionInfo.Password = connInfo.Password; 
    // Apply the schema name to the table's location 
    table.Location = "dbo." + table.Location; 
    } 
+0

に各テーブルに接続詳細を割り当てます上の画像のエラー – riki