.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Trouble Connecting to a Database

Posted By:      Posted Date: September 06, 2010    Points: 0   Category :Sql Server
I downloaded a sample DB from here: http://msftdbprodsamples.codeplex.com/releases/view/4004   Specifically, this is the ‘ AdventureWorksLT.msi ’ So, I loaded it into my SSMSE, right-click Databases > Attach > Database > Attach > etc., etc.   Now, in C# (Express) I goto Add new Datasource > Database > Next > New Connection > Browse . . . navigate to the folder that holds the AdventureWorksLT.mdf Select it and click Open and then I get this message: AdventureWorksLT_Data You don’t have permission to open this file Contact the file owner or an administrator to obtain permission.   I don’t think I’ve ever seen this message before, and I am the administrator.  What am I doing wrong here?  Also, what so I need to do to get this working? Thanks! Ryan---

View Complete Post

More Related Resource Links

Connecting to MS SQL Server database using webmatrix.



I am novice  user to raizor syntax using webmatrix and i am trying to connect MS Sql server database (instead of using .sdf file i am using .mdf file) using the tool webmatrix for startersite.

The connection string that i setup as follows.

<?xml version="1.0"?>


        <compilation debug="false" targetFramework="4.0" />
    <add name="OESConnectionString" connectionString="Data Source=.\SQLServer2005;AttachDbFilename=|DataDirectory|\OES_Data.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />


And i am using websecurity helper as well and the setup is as follows.

WebSecurity.InitializeDatabaseConnection("Data Source=INLTE5556\\SQLServer2005;Initial Catalog=OES;Integrated Security=True", "System.Data.SqlClient", "UserProfile", "UserId", "Email", true);

When i am trying to insert the user details into database i am getting the below error.

Format of t

Having Trouble Connecting to BDC


Hello Share Point experts,

For the first time I'm trying to connect to BDC in SharePoint. I created the Application Definition File and successfully uploaded it to the page. Here is the Authentication part of my ADF:

    <AccessControlEntry Principal="domain\admin">
      <Right BdcRight="Execute"/>
      <Right BdcRight="Edit"/>
      <Right BdcRight="SetPermissions"/>
      <Right BdcRight="SelectableInClients"/>
    <AccessControlEntry Principal="domain\admin">
      <Right BdcRight="Execute"/>
      <Right BdcRight="SelectableInClients"/>
  <LobSystemInstance Name="CRMDB">
<Property Name="AuthenticationMode"

Error connecting to Remote report server database in SQL Server 2008 R2 DataCenter Edition

I am trying to configure my report server installed on Server A to point to a reporting services DB on Server B. I am able provide the name and test the connection. However, when i click next on the configuration wizard after providing the Server A name I am receiving the below error: The feature: "Remote access to report data sources and/or the report server database" is not supported in this edition of Reporting Services I have SQL Server 2008 R2 DataCenter Edition on both the servers.    

connecting managementstudio to hosted webserved sql database

in the wizard connecting to a server in the sql server management studio jou have to fil the server name in all the video`s from microsoft are (local) what should i write in this wizzard when i have my database standing by a provider?   

Error while connecting to Database Engine within SSMS 2008

Error text is as below:- any suggestions ?   ===================================   Cannot connect to TEJ-PC.   ===================================   A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (.Net SqlClient Data Provider)   ------------------------------ For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=2&LinkId=20476   ------------------------------ Error Number: 2 Severity: 20 State: 0     ------------------------------ Program Location:      at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)    at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject)    at System.Data.SqlClient.SqlInternalC

Problems Connecting Excel Services to Oracle Database


I am just beginning to experiment with using Excel Services with BI Dashboards in SharePoint 2010.  I created a Excel Workbook that has a data connection using connection type of OLE DB Query with a connection string of "Provider=MSDAORA.1;User ID=<username>;Data Source=<oracleEnvironment>".  I have the Excel Services Authentication Settings set up for a specific SSS ID <mySSSID>.


This Excel Workbook has been Saved to SharePoint with an entire sheet published.  The Excel Web App is displaying the sheet and the Slicers are functioning just like they do in the Excel client.  When I refresh the data on the client I get prompted for a password and it works fine.  When I refresh on the Web App I have received a variety of errors depending on what I try but nothing has helped me track down what I have missed.

Connecting http://www.123-reg.co.uk DataBase


Hi friend...

    I want to access http://www.123-reg.co.uk  DataBase to my application.... I created Webservice for accessing database
    with the following connection string (which is provided by them)

   <add key="ConnectionString" value="Server=ATLAS-SQL-07; Database=kpllogisticscouk_517641;

   User Id=xxxxx;   Password=yyyyy" />

 But it not working... Any idea Friend???????...pls help me

Windows 7 connecting to SQL server 2000 database

Is is possible to connect to a SQL Server 2000 database (running on a windows 2003 server) from a Windows 7 client machine?

Having Trouble Inserting into a MySQL Database



I was recently using an Access Database for a .NET application however, I was coming across the problem that it wasn't allowing me to Insert any new data into the table.  So, I switched to a MySQL database but I am encountering the same issues.  Below is my could in which the information is gathered and submited to the table.  Thanks in advanced for your help.

Protected Sub AddProd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles AddProd.Click

 Dim pid As String
 pid = Request.QueryString("pid")

  Dim conn As New OdbcConnection("DRIVER={MySQL ODBC 3.51 Driver}; SERVER=*server*; PORT=3306; DATABASE=*database*; UID=*user*; PASSWORD=*password*; OPTION=3;")

 Dim query As New OdbcCommand("SELECT Price, Shipping FROM Products WHERE ItemNum = '" & pid & "'", conn)


 Dim reader As OdbcDataReader = query.ExecuteReader

 If reader.Read() Then

 Dim Today As String
 Today = Date.Today

 Dim IP As String
 IP = Request.ServerVariables("REMOTE_HOST")

 Dim Price As Double = reader.Item("Price")

 Dim Shipping As Double = reader.Item("Shipping")


 Dim ItemNum As String = pid

 Dim Quanity As String = Request.Form("txtQuanity")

 Dim EngraveLine1 As String = ""
 Dim EngraveLine2 As Strin

Problem in connecting to oracle database,which is using Provider=MSDAORA.1


Hi I am Naveen, I am upgrading a internal website from .Net 1.1 to .Net2.0 in Vb.

The database is deployed in the server, but i could not connect to that database.

i have to connect database to few drop down lists,

my manager has given connection string to me... i have placed it in web.config and given that link properly in the code..

but the database is not connecting.. the list is showing empty..

my conn string is

<add key="D2" value="Provider=MSDAORA.1;Data Source=baan; User ID=xxxx; Password=xxxx;Persist Security Info=True"/>

can anyone help me,,, thanks in advance...

To Connecting the Database to Gridview Using Ado.net example

The article To Connecting the Database to Gridview Using Ado.net example was added by codenickel on Saturday, October 30, 2010.

In Aspx.cs page------------------------------string connectionString = ConfigurationManager.ConnectionStrings["DropDownListConnectionString"].ConnectionString; protected void Page_Load(object sender, EventArgs e) { SqlConnection con = new SqlConnection

Need information about Connecting to different database form with in a package


We have a UniVerse data base to connect. How to connect to universe database from within ssis package(which connection manager is to be used)?

Custom Authentication and connecting to database?


When SSRS in forms authentication mode, how do reports connect to remote database servers to get data using the report requesting user's login/password?


2008 server Access database connecting win7 workstation with ODBC link works extremely slowly


I have an Access database on a 2008 server (64 bit), and notebooks with 32 bit win7. The program using the mdb is written in delphy, and running on my notebook, and working on data extremely slow. What can be the problem?

The database connector is an ODBC linked network drive.

On that same configured PC with XP it works normally.


connecting to sql database with odbc SqlDriverConnect in c++

I am attempting to access an sql database from c++.  I am having trouble successfully establishing a connection to this database.  My code is as follows:

// initialize return code for sql operation status
	RETCODE returnCode;

	// initialize handles
	SQLHENV handleEnvironment;
	SQLHDBC handleConnection;
	SQLHSTMT handleStatement;

	// allocate environment handle
	SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &handleEnvironment);

	// set odbc driver version for environment
	SQLSetEnvAttr(handleEnvironment,SQL_ATTR_ODBC_VERSION,(void *)SQL_OV_ODBC3, 0);

	// allocate connection handle
	SQLAllocHandle(SQL_HANDLE_DBC, handleEnvironment, &handleConnection);

	// connect to database
	ret = SQLDriverConnect(handleConnection, NULL, (SQLWCHAR*)"DRIVER={SQL Native Client};SERVER=MyComputerName;DATABASE=MyDatabaseName;Trusted_Connection=yes;", SQL_NTS, NULL, 0, NULL, SQL_DRIVER_NOPROMPT);
	// report status
	cout << ret << &quo

Trouble connecting to MSDE from workstations


I have an app I created that uses MSDE. I have a couple of customers running it and there is no need at this time to move away from MSDE.

A new customer I'm working with has 3 machines we've installed things on. I installed an instance of MSDE on an XP machine. It's running fine and my app can connect without any problems.

We just tried to connect from a Windows 7 box and couldn't. Can't ODBC from it either. So I thought maybe this was a Windows 7 issue but I have an XP box and a 7 box for development where I can connect just fine to my SQL 2000 db's from my 7 box no problem. Didn't have to do anything unusual to do that either.

So I had him fire up an XP machine so I could try from there. That didn't work either. Just for the heck of it I decided to check the workgroup names on each computer. They are all different. They network together just fine though. They can all see each other. The sql data folder is even shared and can be accessed from each machine but I don't remember ever having to do that.

I've verified the tcp/ip port # as well via server config and client config. They match. I don't use 1433. The sql server was restarted after the change so that's not the issue.

I'm wondering if it's got something to do with the workgroups being different but that doesn't seem right either.

Any help would be appreciated.

Problem connecting to new database in migration of existing application


I have an existing mobile application in use for several years

Previous server environment: SQL CE 3.0 / SQL Server 2005 / Windows Server 2003.  

New target server enviornment: SQL CE 3.5 SP2 (64bit) / SQL Server 2008 R2 / Windows 2008 x64

Connection is pass-through with IIS_IUSR credentials

Protocol is HTTPS

Diagnostic steps for troubleshooting connection to NEW environment:

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend