tailieunhanh - Microsoft SQL Server 2005 Developer’s Guide- P30

Microsoft SQL Server 2005 Developer’s Guide- P30:SQL Server 2005 is a feature-rich release that provides a host of new tools and technologies for the database developer. This book is written to help database developers and DBAs become productive immediately with the new features and capabilities found in SQL Server 2005. | Chapter 8 Developing Database Applications with ADO 269 Constant Description adPromptNever The ODBC Driver Manager can only use the information provided by the connection string to make a connection. If sufficient information is not supplied the connection fails. adPromptAlways The ODBC Driver Manager always displays the ODBC Administrator to prompt for connection information. adPromptComplete The ODBC driver determines if all the required connection information has been supplied in the connection string. If all the required information is present the connection is made without further prompting. If any of the required information is missing the ODBC Administrator prompts the user for the missing information. adPromptCompleteRequired This option behaves like adPromptComplete except any prompts containing information that has already been supplied are disabled. Table 8-3 ADO MSDASQL Prompt Constants either the connection string must use the DRIVER keyword to make a DSN-less connection or the ODBC Driver Manager must prompt the user for the DSN to make a connection to SQL Server. In this example the DRIVER keyword isn t used and the value of adPromptComplete is specified in the Prompt property. This allows the ODBC Driver Manager to prompt the user to select an existing ODBC data source. After the user has responded to the ODBC Driver Manager prompt the cn Connection object s Open method connects to SQL Server. The Connection object s Open method takes three optional parameters The first optional parameter accepts a string that contains an OLE DB connection string. This parameter performs exactly the same function as the Connection object s ConnectionString property and you can use this parameter as an alternative to setting the ConnectionString property. The second optional parameter accepts a String variable that contains a valid login ID for the target data source. The third optional parameter accepts a String variable that can contain the password for the target

TỪ KHÓA LIÊN QUAN