Showing posts with label visual. Show all posts
Showing posts with label visual. Show all posts

Tuesday, March 27, 2012

Connecting to SQL Server 2005 Express

I am having major issues connecting to SQL Server 2005 Express from Visual Basic 2005 Express, which I have tried on multiple PCs but to no avail. Can somebody please explain to me what I'm doing wrong?

1) I install SQL Server 2005 Express and Visual Basic 2005 Express (With .NET framework and SQL native client of course)
2) I open SQL Server using Management Studio and going in with windows authentication. It automatically sets the log on name to computername\SQLEXPRESS.
3) I create a new database called Test and add one table to it
4) I go into Visual Basic 2005 and create a new project.
5) I go to the projects application settings (Properties - Settings).
6) I set up a new connection string, choosing SQL server as the conection type and then on the Connection Properties window it asks me to select the mdf file for the database. I choose the file Test.mdf from the directory C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\
7) I click on Test Connection.

When I do this on two out of the three home PCs I get the error:
Unable to open the physical file "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Test.mdf".Operating system error 32: "32 (error not found)".
An attempt to attach an auto-named database for file C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Test.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

The third PC gives me a different error:

Cannot open user default database. Login failed. Login failed for user 'DAVE\David'.

I get the same errors when I try to use a connection string inside the code directly. Does anyone have a clue as to why these errors are occuring? Do I need to set up security or something else on the database first, or is there another reason? If anyone can please help me get to the bottom of this or provide a web address where I can get the answer (step by step instructions on how to connect) then I would be most grateful.

error code 32 means:
"The process cannot access the file because it is being used by another process."

So, either use a different file name for your connection in Visual Basic 2005, or try disconnect your connection in SQL Server using Management Studio.

|||

pse post the Connection string... it seems like u r trying to attach a db called Test....

in the second error .. check what is the Default Database given for user DAVE\David.... the default database should exists and this user should be a user of that db.... for debuggin purpose ... just change the default database of this user to Master and try... it will connect...

Madhu

|||

Hi, I get the same error as the original poster of this thread. I have no other database with similar name or anything, and i have not, as far as i know, any other connections to this database, since I just created it. Do you have any idea of how I should go about this?

Thanks

Niclas

sqlsql

Connecting to sql server 2005

I want to connect to database using sql server 2005 through Visual web developer 2005 express edition . what will be the connection string for this....

keywords under * * are for your own variable.

connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ *datafile name *.mdf;Integrated Security=True;User Instance=True"

if it is a database in a local drive

and if you are using a web server ,

connectionString="data source=*ip address * ;user id=userid;password=pass"

|||

The following link might help you..

http://www.connectionstrings.com/?carrier=sqlserver2005

|||

sagar Khatri wrote:

keywords under * * are for your own variable.

connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ *datafile name *.mdf;Integrated Security=True;User Instance=True"

if it is a database in a local drive

In fact that is not the right explanation. The above mentioned syntax is used when you use the SQL Server 2005 Express feature of user instances. The above mentioned sample assumes that yxou have a local SQL Server Express instance (configured with the instance name of SQLEXPRESS). User instances are used to temporary attach datafile to SQL Server instances.

sagar Khatri wrote:

and if you are using a web server ,

connectionString="data source=*ip address * ;user id=userid;password=pass"

This has nothing to do with a web server. The above mentioned syntax is used when you have a SQL Server attached database. No matter which middle tier (either an application you wrote or a web server is connecting to the database server)=, you are able to have multiple conenctions from multiple applications to this database, other then the user instance where only one application can create a user instance and have access to the database at a time.

Jens K. Suessmeyer

http://www.sqlserver2005.de

sqlsql

Connecting to SQL server

Hi

i'm having lots of problems connecting my application to a database. I'm using Visual Web developer 2008 (coding in VB) and trying to connect to a locally installed version SQL server Express.

what i'm trying to do is using a DropDownList box get a user to select a name. This will then automaticly run a SQL query to pull data out of the DB and into a GridView. i'm coding (in VB only) everything under the DropDownList.SelectedIndexChanged section.


the query i want to run is -

SELECT name, description, data_added, priority_id FROM task WHERE (owner_id = (SELECT owner_id FROM owner WHERE (owner_id = @.owner_id)

The owner_id field references another table (owner). Therefore i run the inner query to get the owner_id based on the selected name in the dropDownlist, then let the outer query pull out all tasks which match the result from the inner query.

my code at the moment is

Dim dsAsNew DataSet

Dim myconnectionAs SqlConnection'create a connection

'create connection to DB

myconnection.ConnectionString ="server=localhost;database=taskDB"

'create the sql command

Dim objcmdAsNew SqlCommand("SELECT name, description, data_added, priority_id FROM task WHERE (owner_id = (SELECT owner_id FROM owner WHERE (owner_id = @.owner_id)))", myconnection)

objcmd.Connection.Open()

'open the connection to DB

Dim objreaderAs SqlDataReader = objcmd.ExecuteReader

Dim daAsNew SqlDataAdapter

da.SelectCommand = objcmd

'fails here sql not allowing remote connection

da.Fill(ds)

Me.GridView1.DataSource = da

Me.GridView1.DataBind()

'close the connection to the DB

objcmd.Connection.Close()

The application fails when you select a name from the drop down box.

fails at - myconnection.ConnectionString ="server=localhost;database=taskDB"Error is "Object reference not set to an instance of an object." If i comment out this line, i get the same error but at it stopps at the objcmd.connection.open(). Strange.

Can anyone tell me what i am doing wrong? Have i setup the connection to the DB ok?

Thanks

Cj

You to use the keyword New when creating an object of class SqlConnection.

Dim myconnectionAs New SqlConnection

http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.aspx

Also, the connection string to the database doesn't seem to be right. Have a look at this and try modifying your connection string:

http://www.connectionstrings.com/?carrier=sqlserver2005

Sunday, March 25, 2012

Connecting to SQL Issue

I have a mdf file and log file from msde. I have successfully connected to it in my Visual Studios ASP.net 2.0 Desktop. I am having a problem where it connects. fine but it does not list the tables , diagrams etc. I am trying to build the intake screen with this data but have no tables. Can some one give me a couple of suggestions of why? I am very new to ASP.net and would appreciate any help .How did you connect to the MSDE mdf file? Can you create a Data Connection to it in Server Explorer? Which SQL instance are you using (MSED,SQL Express, etc.)?|||

Hello,

I am using SQL Server Management Studio that came with my visual studios .net 2005.

I open my web application to the design desktop select the tab labeled Server Express the click on the data base to connect it tell me it is connected but no tables show. I was told today by some one I need to be running SQL Server Studio Express I dont understand is the one I have better? The also told me the mdf file was a backup file which they said I need to create a database and then import the mdf backup file into it . I can figure out how to do this I am very new to SQL Server. Help please

Thanks

|||Where does the mdf file come from? Anyways you should attach it to your current SQL instance before you can use it. To do this in Managment Studio, right click Databases in Object Explorer->choose Attach->locate the mdf file. If attach succeeds, you'll see the new attached database under the Databases tree.|||

Thank you,

I found the mdf file to be a bak file I created anew database and restored over the database I created. All tables showed up ok. I only have on question everything seem to work fine except I have no diagrams under the database is this normal not to have this information?

sqlsql

Connecting to SQL Express 2005 via Web.Config file in Visual Studio 2003

Hi

I am following a project to build a small E-Commerce site from a book I have purchased and I have having problems connecting to the SQL Database with the code supplied.

The book is Apress Beginning ASP.NET 1.1 E-Commerce

http://www.amazon.co.uk/Beginning-ASP-Net-1-1-E-Commerce-Professional/dp/1590592549/ref=sr_11_1/202-7684451-7995058?ie=UTF8&qid=1193780707&sr=11-1

The code added to the Web.Config file is :

<configuration>

<appSettings>

<addkey="ConnectionString"value="Server=(local)\NetSDK;Integrated Security=True;Initial Catalog=JokePoint"/>

</appSettings>

The connection details are in a class file called Catalog.vb and is as follows

Imports System.Data.SqlClient

PublicClass Catalog

PublicSharedFunction GetDepartments()As SqlDataReader

'Create the connection object

Dim connectionAsNew SqlConnection(connectionString)

'Create and initialize the command object

Dim commandAsNew SqlCommand("GetDepartments", connection)

command.CommandType = CommandType.StoredProcedure

'Open the connection

connection.Open()

'Return a SqlDataReader to the calling function

Return command.ExecuteReader(CommandBehavior.CloseConnection)

EndFunction

PrivateSharedReadOnlyProperty connectionString()AsString

Get

Return ConfigurationSettings.AppSettings("ConnectionString")

EndGet

EndProperty

EndClass

The error is....

Cannot open database "JokePoint" requested by the login. The login failed. Login failed for user 'MachineName\ASPNET'.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.Data.SqlClient.SqlException: Cannot open database "JokePoint" requested by the login. The login failed. Login failed for user 'MachineName\ASPNET'.

Source Error:

Line 15: 'Open the connectionLine 16:Line 17: connection.Open()Line 18: Line 19: 'Return a SqlDataReader to the calling function


Source File:C:\MyCommerceSite\JokePoint\BusinessObjects\Catalog.vb Line:17

Stack Trace:

[SqlException: Cannot open database "JokePoint" requested by the login. The login failed.Login failed for user 'MachineName\ASPNET'.] System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) System.Data.SqlClient.SqlConnection.Open() JokePoint.Catalog.GetDepartments() in C:\MyCommerceSite\JokePoint\BusinessObjects\Catalog.vb:17 JokePoint.DepartmentsList.Page_Load(Object sender, EventArgs e) in C:\MyCommerceSite\JokePoint\UserControls\DepartmentsList.ascx.vb:44 System.Web.UI.Control.OnLoad(EventArgs e) System.Web.UI.Control.LoadRecursive() System.Web.UI.Control.LoadRecursive() System.Web.UI.Control.LoadRecursive() System.Web.UI.Page.ProcessRequestMain()

The connection tests ok in Visual Studio 2003. All permissions are set using SQL Management Studio Express 2005.

The book is using SQL 2000, I have been trying different connection syntax's in the Web.Config file all day and now I have a big headache. I know its something simple, can anyone please advise ?

Thanks in advance.

Mark

cracken:

<addkey="ConnectionString"value="Server=(local)\NetSDK;Integrated Security=True;Initial Catalog=JokePoint"/>

First, you are trying to connect using windows authentication and not with a SQL Server user credentials. I think the Integrated Security part is causing you the error. Have you tried to connect using SQL Server user credentials ( if any ), or you are using the windows authentication only.

Hope this will help.

|||

Try this...

web.config file:

<connectionStrings>

<addname="ConnectionString";Data Source=(local)\NetSDK;Integrated Security=True;Initial Catalog=JokePoint";

providerName="System.Data.SqlClient" />

</connectionStrings>

after that in the vb page:

Dim sepAsNew SqlConnection("connectionstring")

sep.Open()

Dim commandAsNew SqlCommand("GetDepartments", sep)

command.CommandType = CommandType.StoredProcedure

|||

Hi

Thanks for answering so quick, I am using Windows Integrated Secuity at the moment.

I have tried the suggestion above, but they were not sucessful. What I have done is changed the provier to OleDb and added a bit to the connection string.

I do not seen to get any code errors now, just login errors.

The VB file now looks like:

Imports System.Data

Imports System.Data.OleDb.OleDbConnection

Public Class Catalog

Public Shared Function GetDepartments() As OleDb.OleDbDataReader

'Create the connection object

Dim connection As New OleDb.OleDbConnection(connectionString)

'Create and initialize the command object

Dim command As New OleDb.OleDbCommand("GetDepartments", connection)

command.CommandType = CommandType.StoredProcedure

'Open the connection

connection.Open()

'Return a OleDbDataReader to the calling function

Return command.ExecuteReader(CommandBehavior.CloseConnection)

End Function

Private Shared ReadOnly Property connectionString() As String

Get

Return ConfigurationSettings.AppSettings("ConnectionString")

End Get

End Property

End Class

And the Web.Config connection string :

<configuration>

<appSettings>

<addkey="connectionString"value="Server=(local)\NetSDK; Provider=SQLOLEDB; Integrated Security=SSPI; Initial Catalog=JokePoint"/>

</appSettings>

And the error message :

Cannot open database "JokePoint" requested by the login. The login failed.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details:System.Data.OleDb.OleDbException: Cannot open database "JokePoint" requested by the login. The login failed.

Source Error:

Line 16: 'Open the connectionLine 17:Line 18: connection.Open()Line 19: Line 20: 'Return a OleDbDataReader to the calling function

All access accounts and read / write permission are correct.

Any more advise would be much app.

Regards

Mark

Connecting to SQL Database?

I am very new to web development using Microsoft Visual Studio. (my primary expertise is Framemaker 2003). I am currently going through your ASP.NET 2.0 videos and reproducing the lesson content on my development system. I have Microsoft Visual Studio 2005 Professional Edition. I also have Microsoft SQL Server 2005, Microsoft SQL Server 2000, Microsoft .NET Framework SDK v1.1 and Microsoft .NET Framework SDK v2.0.

I seem to be having difficulties with the SQL interface because when I try to use the Property object from Lesson04, I get System.Web.HttpExceptioon {"Unable to connect to SQL Server database."}. When I subsequently tried to Add New Item - SQL Database from Lesson08, I get a Microsoft Visual Studio error box "Connections to SQL Server files (*.mdf) require SQL Server Express 2005 to function properly. Please verify the installation of the component or download from the URL:http://go.microsoft.com/fwlink/?LinkId=49251"

Any ideas? I know the videos are based on use of the Microsoft Visual Studio Express -- are there significant configuration differences between it and Microsoft Visual Studio Professional that would make these lessons incompatible?

If you have SQL Server Express edition installed on the machine where Visual Studio Express edition is installed, the problem most likely lies in your web.config file. The web.config file holds configuration for we application. Look for a connectionStrings element in that file and verify that it is correct.

|||

There are significant differences between SqlServer 2005 and Sql Server 2005 Express. You must have the Sql Server 2005 Express addition to use databases in your App_Data directory. It sounds like you don't have Express installed.

|||

I am running these lessons on Microsoft Visual StudioProfessional, notExpress. Why would I then have to have SQL ServerExpress installed?

I need to learn how to develop these web applications using the Professional package, especially the ability to interface a web app with a MySql database.

Is there something about these videos that are unique to the Express versions of these tools?

NOTE: My development environment at work is a closed system -- there is no internet connection (DoD classified, etc). I have no Express version of the web development tools installed. What I do have is the full-blowned Professional Team version.

|||

You need some form of a database system to use some of the features of ASP.NET, like Membership and Roles. You can choose most major databases but you will need a "Provider" for the function you are trying to use.

|||

jguadagno:

You need some form of a database system to use some of the features of ASP.NET, like Membership and Roles. You can choose most major databases but you will need a "Provider" for the function you are trying to use.

Please forgive the ignorance: When I say I am NEW that is about as literal as you can get. "Provider"? Is there something I can do with a configuration file or something so that when I select "Website/Add New Item.../SQL Database" I don't get"Connections to SQL Server files (*.mdf) require SQL Server Express 2005 to function properly. Please verify the installation of the component or download from the URL:http://go.microsoft.com/fwlink/?LinkId=49251"?

|||

If you want to add a SQL Server Database to your project you need to have either SQL Server, SQL Server Express or access to a SQL Server. Microsoft provides the "Providers" which implement certain functionality for SQL Server. If you want to use another database like Oracle or MySql, you will need a custom provider.

If you are just using the database for data access, you can use pretty much any database.

For more on the Provider model, check this outhttp://msdn2.microsoft.com/en-us/library/aa479030.aspx . It is about 120 pages.

|||

jguadagno:

If you want to add a SQL Server Database to your projectyou need to have either SQL Server, SQL Server Express or access to a SQL Server. Microsoft provides the "Providers" which implement certain functionality for SQL Server. If you want to use another database like Oracle or MySql, you will need a custom provider.

If you are just using the database for data access, you can use pretty much any database.

For more on the Provider model, check this outhttp://msdn2.microsoft.com/en-us/library/aa479030.aspx . It is about 120 pages.

That is not represented in this list?

I have Microsoft Visual Studio 2005 Professional Edition. I also haveMicrosoft SQL Server 2005, Microsoft SQL Server 2000, Microsoft .NET Framework SDK v1.1 and Microsoft .NET Framework SDK v2.0.

|||

The you will need to create a database on the Microsoft SQL Server 2005 server first. Here is some more information on SQL Serverhttp://msdn2.microsoft.com/en-us/sql/default.aspx

|||

jguadagno:

The you will need to create a database on the Microsoft SQL Server 2005 server first. Here is some more information on SQL Serverhttp://msdn2.microsoft.com/en-us/sql/default.aspx

Actually, I have done that and even updated the "connectString" configuration to point to the "Test" database I created. This is really a tangent to the intent of the the ASP.NET Lesson07, which is supposed to show my how to establish and connect to a SQL Database from within a web application development session.

I greatly appreciate your attempts to help me understand the database connectivity problem I am having. Your comments, however, isn't really addressing my main problem. My problem is directly related to the use of the "Add New Item...SQL Database" from within Visual Studio 2005 Professional. Regardless of what I do with MS SQL Server 2005 I still get the error "...requires SQL Server Express 2005 to function properly".

NOTE: I finally managed to download and install the free Visual Web Development Express 2005 on my home desktop. In addition to installing the Express version of Visual Studio 2005, it also installed the Express version of MS SQL Server. Without ANY configuration changes on my part, I reproduced the ASP.NET Lesson07 on my home desktop and had no problems.

Is there anyone out there that has reproduced these tutorials using Visual Studio 2005 Professional rather than the free Visual Web Development Express 2005.

|||

I'm having the same problem, the same error message when hit 'App-Data'->'add new item' -> 'SQL database'

I have SQL Server 2000 and 2005, VS professional, so I wondered why I need to install Express editions to make the samples work? there must be some ways, just that I dont know.

Connecting to SQL 2005 using VB6

Is there some reference material that shows how to connect to a SQL 2005 DB
using Visual Basic 6? Any help is appreciated.Charlie (jadkins4@.yahoo.com) writes:

Quote:

Originally Posted by

Is there some reference material that shows how to connect to a SQL 2005
DB using Visual Basic 6? Any help is appreciated.


You find the reference for ADO on
http://msdn2.microsoft.com/en-us/library/ms675532.aspx. ADO is a piece
of crap in my opinion, but*it's nevertheless the best option for VB6.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

Thursday, March 22, 2012

Connecting to SQL 2005 server on Windows 2003

Hope this is on the correct forum, if not could the admins move please.

Im running Win XP SP2 Pro + All updates, Visual Studio .Net 2005 and SQL 2005. SQL is running on Win 2003 server. When i try to create a connection on the WinXP system using ODBC i get the following error:

Connection Failed:
SQLSTATE: '01000'
SQL Server Error: 233
[Microsoft] [ODBC SQL server driver][DBNETLIB]Connection open (PreLoginHandshake())
Connection failed:
SQLState: '08001'
SQL Server error: 11
[Microsoft] [ODBC SQL server driver][DBNETLIB]General Network error. Chcek your network documentation.

Ive searched about the error but nothing seems to work - can anyone help to resolve please?

Thanks in advance.

1) Are you making remote connection? If you have SQL 2005 installed on your XP client box, can you try Management studio to connect to remote server? what error you see?

2) Did you install SQL Express 2005 and make remote connection?If so, check this blog:

http://blogs.msdn.com/sql_protocols/archive/2006/03/23/558651.aspx

But I do not think this is the case.

3) more GNE error troubleshooting blog:

http://blogs.msdn.com/sql_protocols/archive/2006/04/12/574608.aspx

Might give you some clue.

Summary, to fix your problem, please:

check our anouncement posted by Nan Tu, provided the answer to the questions for troubleshootin connectivity issue.

Thanks!

Ming.

Monday, March 19, 2012

Connecting to MSDE 2000 over a home network

Hi,

I'm trying to connect to an instance of MSDE 2000 from Visual Studio 2005 over a home network. Although I know how to connect to a database from Visual Studio, I'm pretty clueless about configuring Sql Server to allow the connection (I can connect with no problem when I do so from the same computer). Also, with experimenting I've created a bunch of instances of Sql Server that I don't really need and am not sure how to get rid of them. Thanks in advance for any help.

-Dave

I don't know if this will help, but I've already tried enabling all of the network protocols in the instance. Also, I can easily connect to an Access database over the network.

You may want to start here:

http://msdn2.microsoft.com/en-us/library/ms190944.aspx

Buck Woody

Connecting to MSDE 2000 over a home network

Hi,

I'm trying to connect to an instance of MSDE 2000 from Visual Studio 2005 over a home network. Although I know how to connect to a database from Visual Studio, I'm pretty clueless about configuring Sql Server to allow the connection (I can connect with no problem when I do so from the same computer). Also, with experimenting I've created a bunch of instances of Sql Server that I don't really need and am not sure how to get rid of them. Thanks in advance for any help.

-Dave

I don't know if this will help, but I've already tried enabling all of the network protocols in the instance. Also, I can easily connect to an Access database over the network.

You may want to start here:

http://msdn2.microsoft.com/en-us/library/ms190944.aspx

Buck Woody

Connecting to Microsoft SQL Server

Hi. Im just starting to learn Microsoft Visual Basic .Net, I'm having problem connecting to Microsoft Sql Server for the sample database Northwind. I can see SQL Server Service Manager on my taskbar but not connected. Please help thanks.
Chris,[vbcol=seagreen]
Whats the error?
Dinesh
SQL Server MVP
--
SQL Server FAQ at
http://www.tkdinesh.com
"Chris" <anonymous@.discussions.microsoft.com> wrote in message
news:3E1B5EE1-9707-46D7-8142-B9264FD52ABC@.microsoft.com...
> Hi. Im just starting to learn Microsoft Visual Basic .Net, I'm having
problem connecting to Microsoft Sql Server for the sample database
Northwind. I can see SQL Server Service Manager on my taskbar but not
connected. Please help thanks.
|||...this is the error. Test Connection Failed because of an Error in initializing provider. [DBNETLIB][COnnection Open(Connect()] SQL Server does not exist or Access Denied. I hope you could help me!!!
|||Chris,
See if its due to any of the scenarios mentioned in the below article:
'Potential causes of the "SQL Server Does Not Exist or Access Denied" error
message'
http://support.microsoft.com/?id=328306
Dinesh
SQL Server MVP
--
SQL Server FAQ at
http://www.tkdinesh.com
"Chris" <anonymous@.discussions.microsoft.com> wrote in message
news:9F5AAE66-7434-4F9D-971B-B94733F9FF60@.microsoft.com...
> ...this is the error. Test Connection Failed because of an Error in
initializing provider. [DBNETLIB][COnnection Open(Connect()] SQL Server does
not exist or Access Denied. I hope you could help me!!!

Connecting to Microsoft SQL Server

Hi. Im just starting to learn Microsoft Visual Basic .Net, I'm having proble
m connecting to Microsoft Sql Server for the sample database Northwind. I ca
n see SQL Server Service Manager on my taskbar but not connected. Please hel
p thanks.Chris,
Whats the error?
Dinesh
SQL Server MVP
--
--
SQL Server FAQ at
http://www.tkdinesh.com
"Chris" <anonymous@.discussions.microsoft.com> wrote in message
news:3E1B5EE1-9707-46D7-8142-B9264FD52ABC@.microsoft.com...[vbcol=seagreen]
> Hi. Im just starting to learn Microsoft Visual Basic .Net, I'm having
problem connecting to Microsoft Sql Server for the sample database
Northwind. I can see SQL Server Service Manager on my taskbar but not
connected. Please help thanks.|||...this is the error. Test Connection Failed because of an Error in initial
izing provider. [DBNETLIB][COnnection Open(Connect()] SQL Server doe
s not exist or Access Denied. I hope you could help me!!!|||Chris,
See if its due to any of the scenarios mentioned in the below article:
'Potential causes of the "SQL Server Does Not Exist or Access Denied" error
message'
http://support.microsoft.com/?id=328306
Dinesh
SQL Server MVP
--
--
SQL Server FAQ at
http://www.tkdinesh.com
"Chris" <anonymous@.discussions.microsoft.com> wrote in message
news:9F5AAE66-7434-4F9D-971B-B94733F9FF60@.microsoft.com...
> ...this is the error. Test Connection Failed because of an Error in
initializing provider. [DBNETLIB][COnnection Open(Connect()] SQL Ser
ver does
not exist or Access Denied. I hope you could help me!!!

Sunday, March 11, 2012

Connecting to Database On windows 5.0 CE Device.

I'm a beginner in the Visual Studio Development for Mobile Devices.

I'm trying to develop a small program for a PSC Falcon handheld Scanner.

Particluars are

VS 2005 SP1

SQL Compact Edition

Windows CE 5.0

The test program is just a datagrid viewing data from the database

when the form loads with the following code:

Me.TblDetailsTableAdapter.Fill(Me.Test3DataSet.tblDetails)

trapping the error I get

Error Code: 8007000E

Message :

Minor Code:0

Source : SQL Server Compact Edition ADO.NET Data Provider

The interesting thing is that if I have the Database open in Query Analyzer 3.0.

The program works fine.

Maybe this is relevant: SqlCeCommand objects are not automatically disposed if you use a SqlCeDataAdapter object

http://support.microsoft.com/default.aspx/kb/824462

|||

Thanks for the timely response.

Being under a ending time schedule.

I went in a different direction to collect the scanned data.

Collecting in a Dataset and writing to a txt file.

I'll keep this in mind for future development.

connecting to database in runtime using visual basic 6

hi;
i design a crystal report outside visual basic 6. what i did is just calling the crystal report filename. how can i change the source database of my crystal reports in runtime. im using microsoft sql server. the two database had the same table structure.
thanksWhich version of CR are you using?
If it is CR9 then
cr.Database.LogOnServer "p2ssql.dll", "Server", "Database", "UserName,"Password"

Saturday, February 25, 2012

connecting SQLExpress & Visual C# 2005

Hi

I have started to create a databse using SQL Server Management Studio Express, just a few tables, one with data. I now want to creat a some windows forms to populate the tables. However when I try to use the Add New Data Source wizard, I get an error when I try to create the connection string, but I have managed to connect to a copy of AdventureWorks located in the same parent directory.

Error is :
Unable to open the physical file "...". Operating system error 32: "32(The process cannot access the file because it is being used by another process.)".
An attemp to attach an auto-named database for file ... failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

As I can connect to AdventureWorks, I presume Windows thinks the file is open, but I have no idea why, how to check, or how to close it.

TIA

Graham

Now Sorted not quite sure what I did, but I have downloaded some updates today, and I did start by looking at the data in Adveture works before I opened my project

Connecting SQL server to the net?

Hi all. Im using Visual Web developer 2005 and have successfully connected my SQL Server to Visual Web developer website. When i run it locally, its fine. But, i now would like the site to be placed on the net - but im not sure how to connect it properly in the webhost. Can someone tell me how this is done please, or a link? cheers.

You can add a connection string on web.config file

<connectionStrings>

<add name="connectioname" connectionString="server=database server;uid=username; pwd=pasword; database=databasename;"/>

</connectionStrings>

then call this connection string on your page.

string strCon = System.Configuration.ConfigurationManager.ConnectionStrings["connectionname"].ConnectionString;

I hope this will help.

|||

Ok.....im still rather confused on how exactly the databse is linked. Firstly, i have the site on a external harddrive....but ive found that the SQL server databse is placed in a totally different location - C:\Program Files (x86)\Microsoft SQL Server\MSSQL.2\MSSQL\Data\Database.mdf

Surely i would have to link it some how for the site/databse to work properly on the site?

|||No ideas guys? Surely there must be a way so i can upload my SQL server database and connect it to my website? I can do it easily in Visual Web Developer in my computer....but stummped how to do it on the net.....|||

Hi,

You may follow the steps below.

First, backup you local database.

Second, get the physical folder of the database file exist on your server. From your previous post, it isC:\Program Files (x86)\Microsoft SQL Server\MSSQL.2\MSSQL\Data\.

Third, restore your backup file to your server database. (Note, you have to replace theMove to Physical file nameitem in the Option tab with your real server-side database folder.)

Third, modify the connection string in your web.config file and call the string in your code by ConfigurationManager.

Thanks.

Connecting SQL SERVER 2005 EXPRESS EDITION using Server Explorer

Hi all.

I use Visual Studio .NET 2002 and SQL Server 2005 Express Edition as database.

I try to connect to database using server explorer.

Test connection is OK. When I done with it and click OK, the message prompt that "Unable to connect to database".

So, is it impossible to connect SQL Server 2005 Express Edition using the server explorer?

But, the connection is ok when I connect through code cause I can retrieve and update database.

Hi azrina,

From your description I would guess, are you connecting to your sql express database both from your code and server explorer? and besides, you choose "auto attached" for your database file(.mdf), am I right?

If yes, i would say, well, since sql express use "custom instance" and there is a basic principle that one mdf file cannot be bound to more than 1 instance at the same time, so, if you are accessing your database file from your code, that particular file(say, dbname.mdf file) would be attached to your sql express custom instance. While if now you are connecting to the sql express again from server explorer, probably you will be not able to access that database file --most possibly you will get a "the database file has been already been attached" error.

Anyway, that's just my assumption and I use visual studio 2005 instead of vs.net 2002. And by the way, I've also encountered some kinds of troubles when connecting to my database from server explored--which sometimes I find is hard to descibe and explain.

Just hope my suggestion could help

|||Actually, what I am trying to do is to add database to the server explorer. As I want to use the DataSet, I can just drag and drop the sqlconnection and etc coz vs studio.net tools support the data access using data set. But, I think this version of my Visual Studio .Net does not support the SQL Server 2005 Express Edition. What can I do now is just do the data access thru code and not using the tools provided.

Friday, February 24, 2012

connecting my VB database to SQL Server Managment Studio?

hi

i have created a sql database in visual studio pro and now i would like to connect to that database in SQL server managamenet studio. so when i start SQL server i connect to the same instance as my database (wich is .\SQLEXPRESS) but i can't find my database in the object explorer?

when you created the database in VB did you connect to a file rather than a database? This means that you have used a user instance, in that case the database is attached to a different instance of the server than .\sqlexpress. If you remember the path to the database then just right click on the databases folder and select attach db and then browse to the file, the db should now appear.

However I will say that once the file is attached to sql server theny ou can no longer use it as a file as I think you were, you will need to change the connection string in your VB app, you can do this using the same wizard that you you used but by selecting a different option.

Sunday, February 19, 2012

Connecting Data with Groups

I'm creating Reporting Services reports in Visual Studio. I'm in the
interface that shows the Data, Layout, and Preview tabs.
I've recently learned that I can drag a list control onto the design surface
from the toolbox, then drag a field from the dataset onto the list control.
I can click the list control properties, click "Edit details group..." In
the top line of the expression list, I choose my field from the dropdown. I
check "Page break at end." If my data is from "select name from mytable", and
there's 4 names, I get 4 pages. This works great!
Here's the problem. I want my data to be from "select name, itemsordered,
itemsbought from mytable". I want itemsordered and itemsbought to go into a
table, leaving name in the list control. How do I reference the table control
to the list control?
I have 4 records. In everything I've tried, pages 1-4 show the names in the
list control, and pages 5-8 show the items in the table. Page 1 should show
the name from record 1, and the items in the table from record 1. Page 2
should show the name from record 2, and the items in the table from record
2...
--
RandyI believe I was one of those who answered before and thought this may be an
issue. There are a couple of approaches you can take. The first is to
continue using the list control. You can actually drag any fields you want
into it. Resize it if you don't have enough room. You can arrange the
additional fields in a table format.
If you want a real table format then you should replace the list control
with the table control.
You'll start out with three rows, the header, detail and footer.
Right click on the gray row selector on the far left of the detail row.
Click "Insert Group"
In the first row of the expressions list pick the name field from the combo
box.
Check the "Page break at end" check box below.
Click "OK"
You'll now have two new rows in the table, one above and one below the
detail row. These are the group header and footer rows.
You can drag the name field to the group header.
You can drag the other fields to the detail row.
Based on your first post it sounds like you'll need more than one detail row
to accomodate all of the fields. If this is the case, simply right click on
the row selector for the detail row and click "Insert row above" or "Insert
row below" and this will add detail rows. You can also right click on the
group footer row selector and choose "Delete rows" to delete it if you don't
need a group footer. You should also know that if you need more columns to
arrange your fields you can right click on the column selectors and insert
additional columns.
Hope that helps.
"randy1200" wrote:
> I'm creating Reporting Services reports in Visual Studio. I'm in the
> interface that shows the Data, Layout, and Preview tabs.
> I've recently learned that I can drag a list control onto the design surface
> from the toolbox, then drag a field from the dataset onto the list control.
> I can click the list control properties, click "Edit details group..." In
> the top line of the expression list, I choose my field from the dropdown. I
> check "Page break at end." If my data is from "select name from mytable", and
> there's 4 names, I get 4 pages. This works great!
> Here's the problem. I want my data to be from "select name, itemsordered,
> itemsbought from mytable". I want itemsordered and itemsbought to go into a
> table, leaving name in the list control. How do I reference the table control
> to the list control?
> I have 4 records. In everything I've tried, pages 1-4 show the names in the
> list control, and pages 5-8 show the items in the table. Page 1 should show
> the name from record 1, and the items in the table from record 1. Page 2
> should show the name from record 2, and the items in the table from record
> 2...
> --
> Randy|||Hi Randy,
Welcome to use MSDN Managed Newsgroup Support.
From your description, my understanding of this issue is: You want to show
reference a table in a list. If I misunderstood your concern, please feel
free to point it out.
You can just drag a table in to the list control and put the fields into
the table.
Hope this will be helpful.
Wei Lu
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
=====================================================When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================This posting is provided "AS IS" with no warranties, and confers no rights.|||Many thanks for the responses. They are appreciated. Your previous response
did help a lot.
The idea is I'd like to sync different toolbox containers to display from
the same record.
I get the idea that I can just position items from the DataSet within a
large listbox. I'm just surprised that Microsoft didn't provide a facility
to allow items from the same record to display in different tools such as
table and list. I can imagine times when it would be very useful.
Randy
"Limey" <Limey@.discussions.microsoft.com> wrote in message
news:F8DA3AB0-25D7-4EF6-ACEB-0CF0E6CF899B@.microsoft.com...
>I believe I was one of those who answered before and thought this may be an
> issue. There are a couple of approaches you can take. The first is to
> continue using the list control. You can actually drag any fields you
> want
> into it. Resize it if you don't have enough room. You can arrange the
> additional fields in a table format.
> If you want a real table format then you should replace the list control
> with the table control.
> You'll start out with three rows, the header, detail and footer.
> Right click on the gray row selector on the far left of the detail row.
> Click "Insert Group"
> In the first row of the expressions list pick the name field from the
> combo
> box.
> Check the "Page break at end" check box below.
> Click "OK"
> You'll now have two new rows in the table, one above and one below the
> detail row. These are the group header and footer rows.
> You can drag the name field to the group header.
> You can drag the other fields to the detail row.
> Based on your first post it sounds like you'll need more than one detail
> row
> to accomodate all of the fields. If this is the case, simply right click
> on
> the row selector for the detail row and click "Insert row above" or
> "Insert
> row below" and this will add detail rows. You can also right click on the
> group footer row selector and choose "Delete rows" to delete it if you
> don't
> need a group footer. You should also know that if you need more columns
> to
> arrange your fields you can right click on the column selectors and insert
> additional columns.
> Hope that helps.
>
> "randy1200" wrote:
>> I'm creating Reporting Services reports in Visual Studio. I'm in the
>> interface that shows the Data, Layout, and Preview tabs.
>> I've recently learned that I can drag a list control onto the design
>> surface
>> from the toolbox, then drag a field from the dataset onto the list
>> control.
>> I can click the list control properties, click "Edit details group..." In
>> the top line of the expression list, I choose my field from the dropdown.
>> I
>> check "Page break at end." If my data is from "select name from mytable",
>> and
>> there's 4 names, I get 4 pages. This works great!
>> Here's the problem. I want my data to be from "select name, itemsordered,
>> itemsbought from mytable". I want itemsordered and itemsbought to go into
>> a
>> table, leaving name in the list control. How do I reference the table
>> control
>> to the list control?
>> I have 4 records. In everything I've tried, pages 1-4 show the names in
>> the
>> list control, and pages 5-8 show the items in the table. Page 1 should
>> show
>> the name from record 1, and the items in the table from record 1. Page 2
>> should show the name from record 2, and the items in the table from
>> record
>> 2...
>> --
>> Randy|||Many thanks for the response.
What you said here is exactly right. The problem is that my DataSet is a
select statement which uses both inner and outer joins. If there's not a
one-to-one relationship for a joined record, then the table can end up
displaying more than one record for a given item in the list control.
It really seems funny to me that Microsoft doesn't provide a mechanism to
link different tools from the toolbox (such as table and list) to a given
record.
Randy
"Wei Lu" <t-weilu@.online.microsoft.com> wrote in message
news:OHaY6b9RGHA.3492@.TK2MSFTNGXA03.phx.gbl...
> Hi Randy,
> Welcome to use MSDN Managed Newsgroup Support.
> From your description, my understanding of this issue is: You want to show
> reference a table in a list. If I misunderstood your concern, please feel
> free to point it out.
> You can just drag a table in to the list control and put the fields into
> the table.
> Hope this will be helpful.
> Wei Lu
> Microsoft Online Partner Support
> Get Secure! - www.microsoft.com/security
> =====================================================> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> =====================================================> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>|||I have needed to do what you are talking about many times (if I understand
correctly). When using list boxes ... if you have multiple groupings then
you need to nest the list boxes within each other. For instance ... if you
have data like city, state, country. You can create a table that has
groupings by country, state, and city and display detail info about the city
within the table. If you want to have a similar display using lists ... then
you must have 3 list boxes nested. The outer is grouped by country, next
inner list is state, and inside state is city. That might get you started.
"Randy" wrote:
> Many thanks for the response.
> What you said here is exactly right. The problem is that my DataSet is a
> select statement which uses both inner and outer joins. If there's not a
> one-to-one relationship for a joined record, then the table can end up
> displaying more than one record for a given item in the list control.
> It really seems funny to me that Microsoft doesn't provide a mechanism to
> link different tools from the toolbox (such as table and list) to a given
> record.
> Randy
> "Wei Lu" <t-weilu@.online.microsoft.com> wrote in message
> news:OHaY6b9RGHA.3492@.TK2MSFTNGXA03.phx.gbl...
> > Hi Randy,
> >
> > Welcome to use MSDN Managed Newsgroup Support.
> >
> > From your description, my understanding of this issue is: You want to show
> > reference a table in a list. If I misunderstood your concern, please feel
> > free to point it out.
> >
> > You can just drag a table in to the list control and put the fields into
> > the table.
> >
> > Hope this will be helpful.
> >
> > Wei Lu
> > Microsoft Online Partner Support
> >
> > Get Secure! - www.microsoft.com/security
> > =====================================================> > When responding to posts, please "Reply to Group" via your newsreader so
> > that others may learn and benefit from your issue.
> > =====================================================> > This posting is provided "AS IS" with no warranties, and confers no
> > rights.
> >
>
>

Friday, February 17, 2012

Connecting an existing database to Management Studio

Hello,

I use visual studio express 2005, and just downloaded Management Studio Express. (I have SQL Express).

I've already created my projects and created database tables and everything but I do not know how to connect an existing database to management studio. Can someone tell me how to connect an existing database to management studio?

Thanks,

Computergirl

Here are few links that can help you

http://technet.microsoft.com/en-us/library/ms167593.aspx

http://technet.microsoft.com/en-us/library/ms170681.aspx