Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rdoEngine DSN error

Status
Not open for further replies.

jmcg

Technical User
Jun 30, 2000
223
0
0
GB
I am trying to run some VB5 code registering a DSN, I am getting 'ActiveX component can't create object/return reference' error.
This is the code:
strAttribs = "Description= SQL Server Test" _
& Chr$(13) & "OemToAnsi=No" _
& Chr$(13) & "SERVER=147.149.160.24" _
& Chr$(13) & "Database=REPWEB"

rdoEngine.rdoRegisterDataSource "TIMnew", "SQL Server", True, strAttribs

Any help appreciated
 
[tt]

rdoRegisterDataSource Method Example
The following example illustrates use of the rdoRegisterDataSource method to create a new ODBC data source entry.

Private Sub RegisterDataSource()
Dim en As rdoEnvironment
Dim cnTest As rdoConnection
Dim strAttribs As String
' Build keywords string.
strAttribs = "Description=" _
& "SQL Server on server SEQUEL" _
& Chr$(13) & "OemToAnsi=No" _
& Chr$(13) & "SERVER=SEQUEL" _
& Chr$(13) & "Network=DBNMPNTW" _
& Chr$(13) & "Database=WorkDB" _
& Chr$(13) & "Address=\\SEQUEL\PIPE\SQL\QUERY"

' Create new registered DSN.
rdoEngine.rdoRegisterDataSource "Example", _
"SQL Server", True, strAttribs
' Open the database.
Set en = rdoEngine.rdoEnvironments(0)
Set cnTest = en.OpenConnection( _
dsname:="Example", _
Prompt:=rdDriverNoPrompt, _
Connect:="UID=;PWD=;")


End Sub

[/tt]


rdoRegisterDataSource Method (Remote Data)


Enters connection information for an ODBC data source into the Windows Registry.

Syntax

rdoRegisterDataSource DSN, driver, silent, attributes

The rdoRegisterDataSource method syntax has these parts:

Part Description
DSN A string expression that is the name used in the OpenConnection method that refers to a block of descriptive information about the data source. For example, if the data source is an ODBC remote database, it could be the name of the server.
driver A string expression that is the name of the ODBC driver. This isn’t the name of the ODBC driver dynamic link library (DLL) file. For example, SQL Server is a driver name, but SQLSRVR.DLL is the name of a DLL file. You must have ODBC and the appropriate driver already installed.
silent A Boolean value that is True if you don’t want to display the ODBC driver dialog boxes that prompt for driver-specific information, or False if you do want to display the ODBC driver dialog boxes. If silent is True, attributes must contain all the necessary driver-specific information or the dialog boxes are displayed anyway.
attributes A string expression that is a list of keywords to be added to the ODBC.INI file. The keywords are in a carriage-return-delimited string.


Remarks

When you use the OpenConnection or EstablishConnection method, you can use a registered data source entry to provide connection information.

If the data source is already registered in the Windows Registry when you use the rdoRegisterDataSource method, the connection information is updated. If the rdoRegisterDataSource method fails for any reason, no changes are made to the Windows Registry, and an error occurs.

For more information about ODBC drivers such as SQL Server, see the Help file provided with the driver.

Note You are encouraged to use the Windows Control Panel 32-bit ODBC Data Sources dialog box to add new data sources, or to make changes to existing entries.

Microsoft SQL Server Attributes

The following attributes are used when setting up DSN entries for Microsoft SQL Server drivers as extracted from the Drvssrvr.Hlp file. Other vendor’s drivers expose their own set of attributes that might or might not conform to this set. See the documentation provided with your driver for additional details.

Keyword Description
ADDRESS The network address of the SQL Server database management system from which the driver retrieves data.
DATABASE The name of the SQL Server database.
DESCRIPTION A description of the data in the data source.
LANGUAGE The national language to be used by SQL Server.
NETWORK The network library connecting the platforms on which SQL Server and the SQL Server driver reside.
OEMTOANSI Enables conversion of the OEM character set to the ANSI character set if the SQL Server client machine and SQL Server are using the same non-ANSI character set. Valid values are YES for on (conversion is enabled) and NO for off.
SERVER The name of the network computer on which the data source resides.
TRANSLATIONDLL The name of the DLL that translates data passing between an application and a data source.
TRANSLATIONNAME The name of the translator that translates data passing between an application and a data source.
TRANSLATIONOPTION Enables translation of data passing between an application and a data source.
USEPROCFORPREPARE Disables generation of stored procedures for SQLPrepare. Valid values are NO for off (generation is disabled) and YES for on. The default value (set in the setup dialog box) is YES.


Setting the OEMTOANSI Option

If the SQL Server client computer and SQL Server are using the same non-ANSI character set, select this option. For example, if SQL Server uses code page 850 and this client computer uses code page 850 for the OEM code page, selecting this option will ensure that extended characters stored in the database are property converted to ANSI for use by Windows-based applications.

When this option is set to YES and the SQL Server client machine and SQL Server are using different character sets, you must specify a character set translator.

Setting the Server Option

The Server option sets the name of the server. “(local)” can be entered as the server on a Microsoft Windows NT computer if the DSN is intended to reference a server on the local system. The user can then use a local copy of SQL Server (that listens on named pipes), even when running a non-networked version of SQL Server. Note that when the 16-bit SQL Server driver is using “(local)” without a network, the MS Loopback Adapter must be installed.

For more information about server names for different types of networks, see Microsoft SQL Server Setup.

Setting the Address Option

The Address option sets the network pathname address of the SQL Server database management system (DBMS) from which the driver retrieves data. For Microsoft SQL Server you can usually omit this argument when sets it to (Default).

Setting the Network Option

The Network attribute sets the name of the 32-bit SQL Server Net-Library DLL that the SQL Server driver uses to communicate with the network software. If this option is not provided, the SQL Server driver uses the client computer’s default Net-Library, which is specified in the Default Network box in the Net-Library tab of the SQL Server Client Configuration Utility.

If you create a data source using a Network Library and optionally a Network Address, ODBC SQL Server Setup will create a server name entry that you can see in the Advanced tab in the SQL Server Client Configuration Utility. These server name entries can also be used
 
Can u tell me the ACCESS equivalent
FOR THE SQL SERVER
 

alishaa,

You really should start your own thread because jmcg has recieved an e-mail because of your post in this thread. If you look on the right side of your screen you will see "Who's marked this thread" just below the "Click here to mark this thread for e-mail notification." link, and as you can see this thread is over a year old.

Now if you want to reference this thread in your new thread look at the top just under the title for this thread. Do you see where it says thread222-357614? As you see it, is how you would type it in your new thread. This site has a macro (for lack of a better word) that looks for that structure and will make it a link for you.

Now with all of that said have you tried using the Advanced search capabilities of this site? Try Access ODBC DSN. You might find what you are looking for.

Good Luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top