![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Using ADODB I'm trying to edit an SQL database using the ADODB object, using Mircosoft SQL Server 2005 Express. The script runs from the command line not from a WEB page. If I have Attached to the database using server management studio, then I can open the database, but if I have not already attached to the database then the processs fails. The Current Code I have is Dim oSQLServer Dim sConnectionString sConnectionString = "Driver={SQL Server};Server=KDANCERLTXP; Database=i96X;Uid=sa;Pwd=XXXX;" Set oSQLServer = CreateObject("ADODB.Connection") oSQLServer.Open sConnectionString If SQL Server has not already attached to the data base how do I use the ADODB object to attach to the database before I open it? |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Using ADODB It maybe because SQLExpress catalogues are loaded from a file when needed unlike regular SQL ones. I wouldn't use ODBC connection (the 'driver' keyword means it's using ODBC). Take a look at http://www.connectionstrings.com and pick one the more modern connection strings such as: Server=.\SQLExpress;AttachDbFilename=c:\asd\qwe\mydbfile.mdf;Database=dbname;Trusted_Connection=Yes; (under SQL 2005 section, you may want to use username/password instead of Windows authentication) Alternatively use: Server=myServerAddress\SQLExpress;Database=myDataBase;User ID=myUsername;Password=myPassword;Trusted_Connection=False; (SQL Express usually runs as a named instance) -- Joe Fawcett (MVP - XML) http://joe.fawcett.name "Sparkie" <Sparkie@xxxxxx> wrote in message news:0741FF0F-A40F-4D37-B786-CF81B2415074@xxxxxx Quote: > I'm trying to edit an SQL database using the ADODB object, using Mircosoft > SQL Server 2005 Express. The script runs from the command line not from a > WEB page. > > If I have Attached to the database using server management studio, then I > can open the database, but if I have not already attached to the database > then the processs fails. > > The Current Code I have is > > Dim oSQLServer > Dim sConnectionString > sConnectionString = "Driver={SQL Server};Server=KDANCERLTXP; > Database=i96X;Uid=sa;Pwd=XXXX;" > Set oSQLServer = CreateObject("ADODB.Connection") > oSQLServer.Open sConnectionString > > If SQL Server has not already attached to the data base how do I use the > ADODB object to attach to the database before I open it? > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Error using SUM() with the ADODB Object | VB Script | |||
| Using SUM with ADODB object | VB Script | |||
| migrating vb6 code using adodb | .NET General | |||
| ADODB: com and .net | PowerShell | |||
| Powershell 32 vs. 64 when using ADODB | PowerShell | |||