The rdoRegisterDataSource Method may be used to do this. I am putting some extracts from MSDN Help edition. you can find more about it there. Please see if this suffices ur problem.
rdoRegisterDataSource Method enters connection information for an ODBC data source into the Windows Registry.
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