473,804 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ADODB.Connectio n and SQLEXPRESS

Can I use SqlExpress2005 AttachDatabase feature with classic ADO connections
in my .asp pages ? But I need ConnectionStrin g. Although I searched the web
for couple of weeks I still coulnd't find any solution.

anybody succeeded to use classic ado with attach feature without attaching
database filed from enterprise manager ? I want tou use SQL2005 and I don't
want directly attch files to sql.

Best regards...

<%
set cn = Server.CreateOb ject("ADODB.Con nection")

' THIS ConnectionStrin g IS WRONG of course. I need correct and working one

ConnectionStrin g=
"Provider=SQLNC LI;Server=.\SQL Express;AttachD bFilename=c:\db \mydbfile.mdf;T rusted_Connecti on=Yes;"

cn.open ConnectionStrin g

..... database operations....

cn.execute sqlstr

cn.close
set cn = nothing
%>

Jan 7 '08 #1
1 8193
Aykut Canturk wrote:
Can I use SqlExpress2005 AttachDatabase feature with classic ADO
connections in my .asp pages ?
I've never done it, but it is supposedly possible
But I need ConnectionStrin g. Although I searched
the web for couple of weeks I still coulnd't find any solution.

anybody succeeded to use classic ado with attach feature without
attaching database filed from enterprise manager ? I want tou use SQL2005
and I
don't want directly attch files to sql.

Best regards...

<%
set cn = Server.CreateOb ject("ADODB.Con nection")

' THIS ConnectionStrin g IS WRONG of course. I need correct and
working one
ConnectionStrin g=
"Provider=SQLNC LI;Server=.\SQL Express;AttachD bFilename=c:\db \mydbfile.mdf;T rusted_Connecti on=Yes;"
From www.connectionstrings.com:
*************** *************** *************** *************** *************
Attach a database file on connect to a local SQL Server Express
instance:

Driver={SQL Native
Client};Server= .\SQLExpress;At tachDbFilename= c:\asd\qwe\mydb file.mdf;
Database=dbname ;Trusted_Connec tion=Yes;

Why is the Database parameter needed? If the named database have
already been attached, SQL Server does not reattach it. It uses the attached
database as the default for the connection.

Attach a database file, located in the data directory, on connect to a
local SQL Server Express instance:

Driver={SQL Native
Client};Server= .\SQLExpress;At tachDbFilename= |DataDirectory| mydbfile.mdf;
Database=dbname ;Trusted_Connec tion=Yes;

Why is the Database parameter needed? If the named database have
already been attached, SQL Server does not reattach it. It uses the attached
database as the default for the connection.
*************** *************** *************** *************** *************

FWIW, I've had issues connecting to SQL 2005 databases from ASP using
trusted connections. I have had to create a SQL login and use it in my
connection strings.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jan 7 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2480
by: Channing Jones | last post by:
Hello everyone, I am trying to store data in a binary field of an SQL-Server table using ADODB. So far, I have managed to store a record but not any data in the binary field. I only get exceptions on various part. I have tried both AppendChunk and using a stream object. Unfortunately all the examples I can find in the Net and on the Microsoft site
5
29854
by: Simone | last post by:
Hello I hope you guys can help me. I am very new to ADO... I am creating a ADODB connection in a module and trying to access it from a command button in a form. Function fxEIDAssgn(plngEID As Long) As Boolean Dim rsAssignedUser As ADODB.Recordset Dim strSelectUser As String
0
3285
by: Andre Azevedo | last post by:
Hi all ! I've created a .net serviced component with only one method. This method receive an ADODB.Command object and execute it. The ADODB.Command object is created in the client process. (VB for example). When I try to set the connection property or try to open a recordset using the Command object I've got an error. Here is the mehotd code for the connection set error:
0
3540
by: ASP.Confused | last post by:
The old message looked a little stale, so I am re-posting it here. Anybody have any ideas of what I could do?!? The previous responses to this question are below. If you want to look at the original question, the subject line is: ADODB.NET and "Access Denied" I have an ASP.NET page writtein in VB that uses ADODB. I just had to
2
8782
by: MasterChief | last post by:
I have a OLEDB Connection String that is working very well for me. My question is that I read that you can store the Connection String in a seperate include file or somewhere else. I am just wondering where is the proper place to store this Connection String and how do I call it from my application. My Example is below Set Conn = Server.CreateObject("ADODB.Connection") Set Rs = Server.CreateObject("ADODB.RecordSet") Conn.Open...
10
5800
by: cleo | last post by:
I am migrating from VB6/Access to Visual Basic and SQL Express. I have success writing test code on my local machine and am now setting up tests for deployment to a server. I have installed SQL Express on a Windows 2003 Server. I can connect and create databases on the Remote Server from my local machine using SQL Management Express, so I know Remote Access is working. However, I am unable to connect using a connection string within...
3
1994
by: Harry Strybos | last post by:
Hi All I have a really strange problem occurring in my application. When I read in the application settings for connection strings the following happens: Here are my connection string settings - <connectionStrings> <add name="TRM8.UI.My.MySettings.TRM8" connectionString="Data Source=SQLDATA;Initial Catalog=TRM8_PROD;Integrated Security=True"
2
1222
sonu5588
by: sonu5588 | last post by:
I am facing problem in connection. This code is OK , when i Deploy or Create a EXE of this project and install it on other system then the connection error generates, whats the solution to create a globel connection, any body tell me ,,,,,,,...... Public Class Utils '//**************** Connection MUNNA-AB15B2413\SQLEXPRESS Public Shared Connection As String = "Server='MUNNA-AB15B2413\SQLEXPRESS';uid=sa;pwd=123;Initial Catalog=ICS"...
2
6734
EYE4U
by: EYE4U | last post by:
Hi all, This is how you can connect to an Access Database using ADODB.. First add a reference to Microsoft ActiveX Data Objects 2.0 Library Now to lets Declare some variables : Private Con As New ADODB.Connection Private Rec As New ADODB.Recordset * You can set them to Public too if you want to access the Connection and Recordset in any other Form or Module.
0
9576
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10568
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10323
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10311
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7613
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5516
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4292
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3813
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.