Multiple choice asp ado

What must your ASP code have if you are using the DSN method of connecting?

  1. Connection object

  2. Connection string

  3. Both

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

When using the DSN connection method, your ASP code requires both a Connection object (instantiated with Server.CreateObject("ADODB.Connection")) and a connection string that references the DSN name. The Connection object holds the connection state, while the connection string tells the object which preconfigured DSN to use for the connection details.

AI explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) Connection object - This option is incorrect because while using the DSN method of connecting, you need both a connection object and a connection string.

Option B) Connection string - This option is incorrect because while using the DSN method of connecting, you need both a connection object and a connection string.

Option C) Both - This option is correct because if you are using the DSN method of connecting in ASP code, you need both a connection object and a connection string. The connection object is used to establish the connection to the database server, and the connection string contains the necessary information (such as the DSN name) to establish the connection.

The correct answer is C. This option is correct because when using the DSN method of connecting in ASP code, you need both a connection object and a connection string.