Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 how to find error

Author  Topic 

rdg
Starting Member

2 Posts

Posted - 2007-09-27 : 01:52:24

I got following error:
SQL Server does not exist or access denied.

in the following existing code

Sub LoadData()
Dim strConn As String = "data source=localhost; User ID=sa; Password=xxyy; Persist Security Info=True;packet size=4096;Initial catalog=Northwind"
Dim strSQL As String = "Select * From Customers"
Dim cmd As New SqlCommand(strSQL, New SqlConnection(strConn))
cmd.Connection.Open()
Repeater1.DataSource = cmd.ExecuteReader
Repeater1.DataBind()
cmd.Connection.Close()
cmd.Connection.Dispose()
End Sub

Can anyone tell me what is wrong in this code.


rdg

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2007-09-27 : 07:37:08
No error in the code. Either your local sql server does not exist, or your SA password is wrong.

What is wrong with the code is a whole different story

[Signature]For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx
Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page
   

- Advertisement -