Friday, February 10, 2012

Connect to SQL Server

Hi!
I tried to connect to SQL Server database by the following code:

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

Try

Dim con As New SqlConnection("Persist Security Info=False;Integrated Security=SSPI;database=northwind;server=myServerName;Connect Timeout=30")
con.Open()

Catch ex As Exception

Response.Write(ex.Message)

End Try

End Sub

And this error occured:

Login failed for user 'NT AUTHORITY\NETWORK SERVICE'

Please tell me the reason.

Regards!
M.Sadegh Samiei

checkwww.connectionstrings.com for the right connection string.

No comments:

Post a Comment