Showing posts with label explorer. Show all posts
Showing posts with label explorer. Show all posts

Monday, March 19, 2012

I cannot create a brand new MDF (sql server database) with Visual Basic 2005

Hi everybody:

I go to Server Explorer, right click on Data Connection, input the server name (that is, my own computer), give a new name to the database to create, and then inevitably get the error window saying:

An error occurred while establishing a connection to the server. When connectiong to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL server does not allow remote connections. (Provider: Named Pipes Provider, error 40, could not open a conection to SQL Server)

So, how to open a connection to SQL server 2005? I looked in the msdn but found absolutely nothing.

Please help

Paolo

There is a great blog post that discusses common causes of connection errors and the errors that you get when that problem exists. This particular error suggests that SQL Express is not running. Launch SQL Server Configuration Manager and verify that the server is running.

Mike

I cannot create a brand new MDF (sql server database) with Visual Basic 2005

Hi everybody:

I go to Server Explorer, right click on Data Connection, input the server name (that is, my own computer), give a new name to the database to create, and then inevitably get the error window saying:

An error occurred while establishing a connection to the server. When connectiong to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL server does not allow remote connections. (Provider: Named Pipes Provider, error 40, could not open a conection to SQL Server)

So, how to open a connection to SQL server 2005? I looked in the msdn but found absolutely nothing.

Please help

Paolo

There is a great blog post that discusses common causes of connection errors and the errors that you get when that problem exists. This particular error suggests that SQL Express is not running. Launch SQL Server Configuration Manager and verify that the server is running.

Mike

I can not login SQL Server

Hi everybody,
I'm a newbe on SQL Server;
Here my problem is:
In Server Explorer I create a Data Connection to Nortwind. After Creating
the connection I can reach tables of this database.
But: When I want to configure the dataAdapter the problem occurs:
In the configure wizard "Data Soure Login" window comes.
Altought I know the user "sa" password This error comes:
"Login Failed:Not Associated With a Trusted SQL Server Connection. Invalid
Connection String Attribute."
How can I overcome with this problem.
What may be the reason of this problem.
Thanks for any help.
Arif imen
Prowise Software.The most likely reason is that your server is configured for
Windows Authentication only. When you try to use the sa
login for the data source login, you are using SQL Server
authentication. Use Windows Authentication for your
connection. If you need to connect with a SQL login, you
need to change SQL Server's authentication mode to use
Windows and SQL authentication.
-Sue
On Wed, 16 Mar 2005 18:28:53 +0200, "news.microsoft.com"
<arif_cimen@.hotmail.com> wrote:

>Hi everybody,
>I'm a newbe on SQL Server;
>Here my problem is:
>In Server Explorer I create a Data Connection to Nortwind. After Creating
>the connection I can reach tables of this database.
>But: When I want to configure the dataAdapter the problem occurs:
>In the configure wizard "Data Soure Login" window comes.
>Altought I know the user "sa" password This error comes:
>"Login Failed:Not Associated With a Trusted SQL Server Connection. Invalid
>Connection String Attribute."
>How can I overcome with this problem.
>What may be the reason of this problem.
>Thanks for any help.
>Arif imen
>Prowise Software.
>|||Thaks a lot. It works.
"Sue Hoegemeier" <Sue_H@.nomail.please> wrote in message
news:tdmh31llcr09lvf0pa3ihh0d7oiolv0v1c@.
4ax.com...
> The most likely reason is that your server is configured for
> Windows Authentication only. When you try to use the sa
> login for the data source login, you are using SQL Server
> authentication. Use Windows Authentication for your
> connection. If you need to connect with a SQL login, you
> need to change SQL Server's authentication mode to use
> Windows and SQL authentication.
> -Sue
> On Wed, 16 Mar 2005 18:28:53 +0200, "news.microsoft.com"
> <arif_cimen@.hotmail.com> wrote:
>
>

Friday, March 9, 2012

I added a column to a table, but, I can't see it.

I ran the code below that adds a column to an SQL table.

I refreshed Data Sources, but, the new column does not appear.

I refreshed Server Explorer and the new column does not appear.

I tried running the code again and I got:

"Column names in each table must be unique. Column name 'CaseNbr' in table 'Patient' is specified more than once."

so the column did actually get added, but, I can't see it.

Imports System.Data.SqlClient

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

'Try

Dim sqlConnection As New System.Data.SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Patient.mdf;Integrated Security=True;User Instance=True")

Dim str As String = "ALTER TABLE Patient ADD CaseNbr Varchar(50)"

Dim command As New System.Data.SqlClient.SqlCommand(str, sqlConnection)

sqlConnection.Open()

command.ExecuteNonQuery()

sqlConnection.Close()

'Catch

'End Try

Close()

End Sub

End Class

here it runs in query analyzer ...

u do try it..

it must work ..

|||YOu are using an user instance. Data Files of user instances in during development time will be overwritten everytime you start the application from Visual Studio if the setting of "Copy Always" is set to true. Disable this option in order to leave the change in the file.

Jens K. Suessmeyer.

http://www.sqlserver2005.de
|||I had everything set to Do Not Copy.|||If not error tis thrown, the column was created, try to select the information from the INFORMATION_SCHEMA.COLUMNS View after executing your code to create a new column, you will see that the column was added to the table. There has to be a misconfiguration of the deployment where the debug process always copy a new datafile to the directory.

Jens K. Suessmeyer.

http://www.sqlserver2005.de