You really don't need the DSN. Using a DSN, a person will have to set up
the DSN on every workstation that is using the program. This is a pain.
Further, if something changes, a person has to make changes on all the
workstations too.
This sample works well.
Public Const gstrConnect As String =
"UID=username;PASSWORD=password;SERVER=servername;DATABASE=databasename"
Set adoconn = New ADODB.Connection
With adoconn
.Provider = "SQLOLEDB"
.CommandTimeout = 90
.ConnectionString = gstrConnect
.ConnectionTimeout = 90
.CursorLocation = adUseServer
.Mode = adModeReadWrite
.Open
End With
strCmd = "Truncate Table MainUser"
adoconn.Execute strCmd, , adCmdText And adExecuteNoRecords
> First, the physical location of the *.mdf file does not matter. The db
> is propably called Data on the SQL server? Simply create an ODBC
> system DSN to the database. (Depending on what OS you are using , try
> control panel first, use the SQL Driver) You then talk to the db like
> this:
> Set Conn = Server.CreateObject("ADODB.Connection")
> temp = "Provider=SQLOLEDB;SERVER=<servername>;UID=<user id for sql
> server>;DATABASE=<the db you want to use>;UserId=<user
> id>;password=<the password for sql>"
> conn.open temp
> theDSN="DSN=<name of the system DSN>"
> > I have a SQL Server Database at say H:\Databases\Data.mdf
> > With Table People
> > I want a Visual Interdev page (asp) that will accept a person's name
> and
> > store it in the Table People.
> > If someone could show me how to do something simple like this then I
> can
> > take off and learn a lot more. I just want a helping hand getting
> started.
> > Or feel free to show me another example.
> > Take out the _no_more_ to email me.
> > Thanks in advance for any push someone is willing to give me.
> > BTW the web page would be on drive G. Yes - I own my own server. I
> was
> > under the impression the best way to learn is to do everything,
> including
> > hosting your own server. So, I am learning lots of things, I just
> need some
> > pushes.
> > Thanks,
> > Markis
> Sent via Deja.com http://www.deja.com/
> Before you buy.