SQL Server does not exist or access denied

prav_roy

Well-known member
Joined
Sep 10, 2005
Messages
70
Location
Mumbai
Programming Experience
1-3
hi,
im new to SQL SERVER, the error im getting now really made me mad, everywhere i searched but i didnt get sollution, the probis that im using Win-XP OS, my database is sql server 2000 which is not local, when i try to access my database through VB.net Windows Application it gives no error, but when i try to access same database through ASP.NET i get the error saying that
"SQL Server does not exist or access denied"
i dont find anything wrong with the connection string a it works perfect with window application, can anybody give me good sollution of this
Thank you in advance
 
well, it could be your connectionstring... what does it look like?

-tg
 
Hi,
I ran into the same problem.In my case I want to create a new database programmatically from my vb.net application so that i can store some data into it. here is my connection string:
ConnectionString = "Integrated Security=SSPI;" + "Initial Catalog=mydb;" + "Data Source=localhost;"

I found this in a code sample.
 
Integrated Surity=SSPI isn't supported any more in ADO.... Try using "Trusted Connection=True" (or Yes) instead.

-tg\
 
Thanks for your reply. I tried using "Trusted Connection=True" but it isn't supported. here is the code :


PrivateSub ExecuteSQLStmt(ByVal sql AsString)
' Open the connection
If conn.State = ConnectionState.Open Then
conn.Close()
EndIf
ConnectionString = "Integrated Security=SSPI;" + "Initial Catalog=mydb;" + "Data Source=localhost;"
conn.ConnectionString = ConnectionString
conn.Open()
cmd =
New SqlCommand(sql, conn)
Try
cmd.ExecuteNonQuery()
Catch ae As SqlException
MessageBox.Show(ae.Message.ToString())
Finally
cmd.Dispose()
EndTry
EndSub'ExecuteSQLStmt

PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' Create a connection
conn = New SqlConnection(ConnectionString)
' Open the connection
If conn.State <> ConnectionState.Open Then
conn.Open()
EndIf
Dim sql AsString = "CREATE DATABASE mydb ON PRIMARY" + "(Name=test_data, filename = 'C:\Program Files\MySQL\mydb_data.mdf', size=3," + "maxsize=5, filegrowth=10%)log on" + "(name=mydbb_log, filename='C:\MySql\mydb_log.ldf',size=3," + "maxsize=20,filegrowth=1)"
ExecuteSQLStmt(sql)
EndSub'CreateDBBtn_Click
Many thanks in advance.
 
Last edited:
My bad, it's Integrated Security=True....

Here's some sample code I found in some recent training materials that works....

VB.NET:
Dim conSQL As New SqlClient.SqlConnection( )   
  conSQL.ConnectionString = "Integrated Security=True;" & _   
         "Data Source=LocalHost;Initial Catalog=Pubs;"   
  conSQL.Open( )

-tg
 
Any chance you can post a screen shot of the actual error message?

-tg
 
An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll
Additional information: System error.
 
Back
Top