Discussion Locked

create dsn

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Anyone know how to create DSN for SQL2000 and postgres in the vb coding... thanks!!

3 replies

by itpreneur

Dim fsn As New Scripting.FileSystemObject
Dim myDsn As Scripting.TextStream

Set myDsn = fsn.CreateTextFile("c:\viju.dsn")

myDsn.WriteLine "[ODBC]"
myDsn.WriteLine "DRIVER=Microsoft Access Driver (*.mdb)"
myDsn.WriteLine "UID = admin"
myDsn.WriteLine "UserCommitSync = Yes"
myDsn.WriteLine "Threads = 3"
myDsn.WriteLine "SafeTransactions = 0"
myDsn.WriteLine "PageTimeout = 5"
myDsn.WriteLine "MaxScanRows = 8"
myDsn.WriteLine "MaxBufferSize = 512"
myDsn.WriteLine "ImplicitCommitSync = Yes"
myDsn.WriteLine "FIL=SQL Server"
myDsn.WriteLine "DriverId = 25"
myDsn.WriteLine "DefaultDir=C:\"
myDsn.WriteLine "DBQ=C:\DIRECTORY\FILENAME.MDF" '& yourfilename
MsgBox "Your DSN is Created Now"

' Just change the driver to SQL SERVER (*.mdf)
UID='sa' or any administrator user id
PASSWORD='any password' password use to access sql server or leave blankif default for userid sa

This discussion is closed to new replies.