Home All Groups Group Topic Archive Search About

SQL Server connection problem

Author
3 Sep 2006 10:50 PM
djamilabouzid
Hi!
I have some problems with ms sql server database connection. When I
wrote
the following function (in VB):

sub Remplir_Theme()
Dim connectionString As String = "Data Source=.\SQLExpress;
AttachDbFileName=|DataDirectory|\BasedeDonnees_babySQL.mdf ;Integrated
Security=true; User Instance=true"
Dim sqlCon As new System.Data.SqlClient.SQLConnection
(connectionString)
sqlCon.open()
Dim cmd as sqlCommand = new sqlCommand ("Select * from
Table_theme;", sqlCon)
end sub


I Had this error (sorry it's in french)

Server Error in '/' Application.

--------------------------------------------------------------------------------

Échec d'une tentative d'attachement d'une base de données nommée
automatiquement pour le fichier
c:\inetpub\wwwroot\App_Data\BasedeDonnees_babySQL. Il existe une base
de
données du même nom ou le fichier spécifié ne peut être ouvert ou
il se
trouve sur un partage UNC.

When I created a folder named App_Data. and putting inside my mssql
databse
file, I had this error


Server Error in '/' Application.

--------------------------------------------------------------------------------

Impossible d'ouvrir la nouvelle base de données
'C:\INETPUB\WWWROOT\APP_DATA\BASEDEDONNEES_BABYSQL.MDF'. Abandon de
CREATE
DATABASE.
Échec d'une tentative d'attachement d'une base de données nommée
automatiquement pour le fichier
c:\inetpub\wwwroot\App_Data\BasedeDonnees_babySQL.mdf. Il existe une
base de
données du même nom ou le fichier spécifié ne peut être ouvert ou
il se
trouve sur un partage UNC.
Échec de l'activation du fichier. Le nom de fichier physique
'c:\inetpub\wwwroot\App_Data\BasedeDonnees_babySQL_log.ldf' est
peut-être
incorrect.
Impossible de reconstruire le journal lorsque le fichier principal est
en
lecture seule.

Please, someone can help me !

Thanks,

Djamila.

Author
13 Sep 2006 7:53 PM
Sethu Srinivasan [MSFT]
I used document translation in Office 12 to convert message from French to
English, seems like the error messsage in English could be like
"Failure of an attempt at attachment of a data base named automatically for
the c:\ fileinetpub \wwwroot \App_Data \BasedeDonnees_babySQL. There is a
data base of the same name or the specified file cannot be opened or he is
on a division UNC."

Possible reasons,
1) Check if  the file path is accessible and the service account running
SQLServer has file and folder permissions.
2) Check if there is any database with same name was already created or
attached before.

--

Sethu Srinivasan, Software Design Engineer, SQL Server Manageability
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm.
<djamilabou***@gmail.com> wrote in message
news:1157323847.246194.43140@h48g2000cwc.googlegroups.com...
Hi!
I have some problems with ms sql server database connection. When I
wrote
the following function (in VB):

sub Remplir_Theme()
Dim connectionString As String = "Data Source=.\SQLExpress;
AttachDbFileName=|DataDirectory|\BasedeDonnees_babySQL.mdf ;Integrated
Security=true; User Instance=true"
Dim sqlCon As new System.Data.SqlClient.SQLConnection
(connectionString)
sqlCon.open()
Dim cmd as sqlCommand = new sqlCommand ("Select * from
Table_theme;", sqlCon)
end sub


I Had this error (sorry it's in french)

Server Error in '/' Application.

--------------------------------------------------------------------------------

Échec d'une tentative d'attachement d'une base de données nommée
automatiquement pour le fichier
c:\inetpub\wwwroot\App_Data\BasedeDonnees_babySQL. Il existe une base
de
données du même nom ou le fichier spécifié ne peut être ouvert ou
il se
trouve sur un partage UNC.

When I created a folder named App_Data. and putting inside my mssql
databse
file, I had this error


Server Error in '/' Application.

--------------------------------------------------------------------------------

Impossible d'ouvrir la nouvelle base de données
'C:\INETPUB\WWWROOT\APP_DATA\BASEDEDONNEES_BABYSQL.MDF'. Abandon de
CREATE
DATABASE.
Échec d'une tentative d'attachement d'une base de données nommée
automatiquement pour le fichier
c:\inetpub\wwwroot\App_Data\BasedeDonnees_babySQL.mdf. Il existe une
base de
données du même nom ou le fichier spécifié ne peut être ouvert ou
il se
trouve sur un partage UNC.
Échec de l'activation du fichier. Le nom de fichier physique
'c:\inetpub\wwwroot\App_Data\BasedeDonnees_babySQL_log.ldf' est
peut-être
incorrect.
Impossible de reconstruire le journal lorsque le fichier principal est
en
lecture seule.

Please, someone can help me !

Thanks,

Djamila.

AddThis Social Bookmark Button