PC Review


Reply
Thread Tools Rate Thread

cannot connect to SQLServer!

 
 
steve
Guest
Posts: n/a
 
      28th Jul 2003
I keep getting the following error.
I seem to have tried everything, heres the stack trace:-
[SqlException: SQL Server does not exist or access
denied.]
System.Data.SqlClient.SqlConnection.Open() +759
ConnectionTest1.WebForm1.Page_Load(Object sender,
EventArgs e) in c:\inetpub\wwwroot\ConnectionTest1
\WebForm1.aspx.vb:35
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +29
System.Web.UI.Page.ProcessRequestMain() +724
I've pinged the server and it's there!
I can connect through access, I have ASP pages running
off SQL db's on the server.
I am close to the edge
Here's the code I'm running, can anyone help me or walk
me through getting connected pleeeeze.
also any test code would be appreciated:
CODE:
Imports System.Data.SqlClient

Public Class WebForm1
Inherits System.Web.UI.Page


#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private
Sub InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web
Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim strConnection As New SqlConnection
("Password=;" & _
"Persist
Security Info=True;" & _
"User ID=sa;"
& _
"Initial
Catalog=pubs;" & _
"Data
Source=myDatabase")


Dim strSql As String = "SELECT * FROM authors"


Dim objCmd As New SqlClient.SqlCommand(strSql,
strConnection)
strConnection.Open()
'objCmd.ExecuteNonQuery()
strConnection.Close()
End Sub

End Class
Thanks in advance
 
Reply With Quote
 
 
 
 
Steve Chambers
Guest
Posts: n/a
 
      29th Jul 2003
Thanks for reply,
I just used myDatabase for security,
the SQL server is held on our webserver and has the same
name eg steveserver = webserver name
steveserver = instance of sql server
>-----Original Message-----
>Steve,
>
>What's the name of your SQL Server, is it myDatabase? If

not, that might be
>your answer.
>
>--
>Carsten Thomsen
>Enterprise Development with Visual Studio .NET, UML, and

MSF
>http://www.apress.com/book/bookDisplay.html?bID=105
>"steve" <(E-Mail Removed)> wrote in

message
>news:01bd01c35522$9ea1d1c0$(E-Mail Removed)...
>> I keep getting the following error.
>> I seem to have tried everything, heres the stack

trace:-
>> [SqlException: SQL Server does not exist or access
>> denied.]
>> System.Data.SqlClient.SqlConnection.Open() +759
>> ConnectionTest1.WebForm1.Page_Load(Object sender,
>> EventArgs e) in c:\inetpub\wwwroot\ConnectionTest1
>> \WebForm1.aspx.vb:35
>> System.Web.UI.Control.OnLoad(EventArgs e) +67
>> System.Web.UI.Control.LoadRecursive() +29
>> System.Web.UI.Page.ProcessRequestMain() +724
>> I've pinged the server and it's there!
>> I can connect through access, I have ASP pages running
>> off SQL db's on the server.
>> I am close to the edge
>> Here's the code I'm running, can anyone help me or walk
>> me through getting connected pleeeeze.
>> also any test code would be appreciated:
>> CODE:
>> Imports System.Data.SqlClient
>>
>> Public Class WebForm1
>> Inherits System.Web.UI.Page
>>
>>
>> #Region " Web Form Designer Generated Code "
>>
>> 'This call is required by the Web Form Designer.
>> <System.Diagnostics.DebuggerStepThrough()> Private
>> Sub InitializeComponent()
>>
>> End Sub
>>
>> Private Sub Page_Init(ByVal sender As

System.Object,
>> ByVal e As System.EventArgs) Handles MyBase.Init
>> 'CODEGEN: This method call is required by the

Web
>> Form Designer
>> 'Do not modify it using the code editor.
>> InitializeComponent()
>> End Sub
>>
>> #End Region
>>
>> Private Sub Page_Load(ByVal sender As

System.Object,
>> ByVal e As System.EventArgs) Handles MyBase.Load
>> 'Put user code to initialize the page here
>> Dim strConnection As New SqlConnection
>> ("Password=;" & _
>> "Persist
>> Security Info=True;" & _
>> "User

ID=sa;"
>> & _
>> "Initial
>> Catalog=pubs;" & _
>> "Data
>> Source=myDatabase")
>>
>>
>> Dim strSql As String = "SELECT * FROM authors"
>>
>>
>> Dim objCmd As New SqlClient.SqlCommand(strSql,
>> strConnection)
>> strConnection.Open()
>> 'objCmd.ExecuteNonQuery()
>> strConnection.Close()
>> End Sub
>>
>> End Class
>> Thanks in advance

>
>
>.
>

 
Reply With Quote
 
Blore techie
Guest
Posts: n/a
 
      29th Jul 2003
Try this out

Dim sqlCnn as New SQLConnection("server=localhost;initial
catalog = pubs;uid=sa;pwd=;")

sqlCnn.Open

put in your server name nand userid password for the sql
server. it works just fine for me

>-----Original Message-----
>Thanks for reply,
>I just used myDatabase for security,
>the SQL server is held on our webserver and has the same
>name eg steveserver = webserver name
> steveserver = instance of sql server
>>-----Original Message-----
>>Steve,
>>
>>What's the name of your SQL Server, is it myDatabase? If

>not, that might be
>>your answer.
>>
>>--
>>Carsten Thomsen
>>Enterprise Development with Visual Studio .NET, UML, and

>MSF
>>http://www.apress.com/book/bookDisplay.html?bID=105
>>"steve" <(E-Mail Removed)> wrote in

>message
>>news:01bd01c35522$9ea1d1c0$(E-Mail Removed)...
>>> I keep getting the following error.
>>> I seem to have tried everything, heres the stack

>trace:-
>>> [SqlException: SQL Server does not exist or access
>>> denied.]
>>> System.Data.SqlClient.SqlConnection.Open() +759
>>> ConnectionTest1.WebForm1.Page_Load(Object sender,
>>> EventArgs e) in c:\inetpub\wwwroot\ConnectionTest1
>>> \WebForm1.aspx.vb:35
>>> System.Web.UI.Control.OnLoad(EventArgs e) +67
>>> System.Web.UI.Control.LoadRecursive() +29
>>> System.Web.UI.Page.ProcessRequestMain() +724
>>> I've pinged the server and it's there!
>>> I can connect through access, I have ASP pages running
>>> off SQL db's on the server.
>>> I am close to the edge
>>> Here's the code I'm running, can anyone help me or walk
>>> me through getting connected pleeeeze.
>>> also any test code would be appreciated:
>>> CODE:
>>> Imports System.Data.SqlClient
>>>
>>> Public Class WebForm1
>>> Inherits System.Web.UI.Page
>>>
>>>
>>> #Region " Web Form Designer Generated Code "
>>>
>>> 'This call is required by the Web Form Designer.
>>> <System.Diagnostics.DebuggerStepThrough()> Private
>>> Sub InitializeComponent()
>>>
>>> End Sub
>>>
>>> Private Sub Page_Init(ByVal sender As

>System.Object,
>>> ByVal e As System.EventArgs) Handles MyBase.Init
>>> 'CODEGEN: This method call is required by the

>Web
>>> Form Designer
>>> 'Do not modify it using the code editor.
>>> InitializeComponent()
>>> End Sub
>>>
>>> #End Region
>>>
>>> Private Sub Page_Load(ByVal sender As

>System.Object,
>>> ByVal e As System.EventArgs) Handles MyBase.Load
>>> 'Put user code to initialize the page here
>>> Dim strConnection As New SqlConnection
>>> ("Password=;" & _
>>> "Persist
>>> Security Info=True;" & _
>>> "User

>ID=sa;"
>>> & _
>>> "Initial
>>> Catalog=pubs;" & _
>>> "Data
>>> Source=myDatabase")
>>>
>>>
>>> Dim strSql As String = "SELECT * FROM authors"
>>>
>>>
>>> Dim objCmd As New SqlClient.SqlCommand(strSql,
>>> strConnection)
>>> strConnection.Open()
>>> 'objCmd.ExecuteNonQuery()
>>> strConnection.Close()
>>> End Sub
>>>
>>> End Class
>>> Thanks in advance

>>
>>
>>.
>>

>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Connect PDA To SqlServer Paul Microsoft C# .NET 8 13th Mar 2009 05:36 PM
not able to connect to sqlserver yoshitha Microsoft ASP .NET 0 5th Jan 2006 05:28 AM
SQLserver connect ???? mikeb Microsoft Dot NET Compact Framework 7 10th Aug 2005 02:12 AM
Connect to Sqlserver =?Utf-8?B?Rw==?= Microsoft Access 2 6th Apr 2005 05:32 AM
connect to sqlserver? Papa_K Microsoft ASP .NET 1 20th Oct 2003 01:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:59 AM.