OleDbConnection.ConnectionTimeout プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > OleDbConnection.ConnectionTimeout プロパティの意味・解説 

OleDbConnection.ConnectionTimeout プロパティ

接続確立試行開始してから、その試行終了してエラー生成するまでの待機時間取得します

名前空間: System.Data.OleDb
アセンブリ: System.Data (system.data.dll 内)
構文構文

Public Overrides ReadOnly
 Property ConnectionTimeout As Integer
Dim instance As OleDbConnection
Dim value As Integer

value = instance.ConnectionTimeout
public override int ConnectionTimeout { get;
 }
public:
virtual property int ConnectionTimeout {
    int get () override;
}
/** @property */
public int get_ConnectionTimeout ()
public override function get
 ConnectionTimeout () : int

プロパティ
接続開かれるまでの待機時間 (秒)。既定値15 秒です。

例外例外
例外種類条件

ArgumentException

設定値が 0 未満です。

解説解説

0 は、制限なしを示します。ただし、接続試行永久的待機されるため、ConnectionString では使用しないください

使用例使用例

OleDbConnection を作成し、そのプロパティ一部接続文字列設定する例を次に示します

' The connectionString argument contains the Connect Timeout 
' keywords, as follows: "... ;Connect Timeout=30;"
Public Sub InsertRow(ByVal
 connectionString As String, _
    ByVal insertSQL As String)

    Using connection As New OleDbConnection(connectionString)
        ' The insertSQL string contains a SQL statement that
        ' inserts a new row in the source table.
        Dim command As New
 OleDbCommand(insertSQL)

        ' Set the Connection to the new OleDbConnection.
        command.Connection = connection

        ' Open the connection and execute the insert command.
        Try
            connection.Open()
            command.ExecuteNonQuery()
        Catch ex As Exception
            Console.WriteLine(ex.Message)
        End Try
        ' The connection is automatically closed when the
        ' code exits the Using block.
    End Using
End Sub
// The connectionString argument contains the Connect Timeout 
// keywords, as follows: "... ;Connect Timeout=30;"
public void InsertRow(string
 connectionString, string insertSQL)
{
    using (OleDbConnection connection = new
 OleDbConnection(connectionString))
    {
        // The insertSQL string contains a SQL statement that
        // inserts a new row in the source table.
        OleDbCommand command = new OleDbCommand(insertSQL);

        // Set the Connection to the new OleDbConnection.
        command.Connection = connection;

        // Open the connection and execute the insert command.
        try
        {
            connection.Open();
            command.ExecuteNonQuery();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
        // The connection is automatically closed when the
        // code exits the using block.
    }
using System;
using System.Data;
using System.Data.OleDb;

class Class1
{
    static void Main()
    {
    }

    // The connectionString argument contains the Connect Timeout 
    // keywords, as follows: "... ;Connect Timeout=30;"
    public void InsertRow(string
 connectionString, string insertSQL)
    {
        using (OleDbConnection connection = new
 OleDbConnection(connectionString))
        {
            // The insertSQL string contains a SQL statement that
            // inserts a new row in the source table.
            OleDbCommand command = new OleDbCommand(insertSQL);

            // Set the Connection to the new OleDbConnection.
            command.Connection = connection;

            // Open the connection and execute the insert command.
            try
            {
                connection.Open();
                command.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            // The connection is automatically closed when the
            // code exits the using block.
        }
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
OleDbConnection クラス
OleDbConnection メンバ
System.Data.OleDb 名前空間
Database
DataSource
その他の技術情報
データ ソースへの接続



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「OleDbConnection.ConnectionTimeout プロパティ」の関連用語

OleDbConnection.ConnectionTimeout プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



OleDbConnection.ConnectionTimeout プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS