Showing posts with label exception. Show all posts
Showing posts with label exception. Show all posts

Thursday, March 29, 2012

Console.WriteLine generates HostProtectionException

Gotcha!

It took a few minutes of staring at my CLR method (it's actually a ServiceBroker service), trying to figure out why I was getting an exception on something that looked pretty innocuous.

It turned out to be the Console.WriteLine(...) statement. In hindsight, not really much of a surprise . However, for debugging purposes, I'd still like to use Console.WriteLine. Is there a HostProtectionAttribute I can apply that will allow it?

Josh

Yes, you are right, Console.WriteLine is not the appropiate output for debugging in SQL Server. What about using any trace source or even to keep it simple the System.Diagnostics namespace ? This one has some method for the output during the debbuging process.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

Sunday, March 11, 2012

Connection to SQL2005 Database Engine

On one server I connect to I always get this message when I try to launch object explorer.
TITLE: Microsoft SQL Server Management Studio
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
Insert Error :column name or number of supplied values doesn't match.. Error:213.

Sometimes I can run refresh, and it will eventually connect.

Is the version of sql server you're connecting to the same as the one that was installed where you're launching SSMS? If not, and depending on the versions, underlying procs that SSMS depend on may be different between the two versions.
|||The server is SQL Standard Sept. release, and I installed the same version, workstation only on my station. I eventually get the browser to work. Other server is a June release std and it doesn't do this. I reinstalled every workstation component, and now I have SSIS working but still getting the browser error looking at objects on this server. BTW this server has been installed a couple of times .|||I found out that I had some possible old components in the install dir, so I started over again with fresh Sept install. When I did that , I noticed again my SQL2000 Ent Mgr quit working as I uninstalled. Prev. I had repatched SQL sp4 then reran setup of 2005. This time I left it alone , finished up install, and lo and behold the object browser works AND SQL 2000 Ent. MGr. What I am trying to deduce is the sqldmo dll might be involved . Does SQL2005 install replace that in the Windows directory , and it happens to have backwards compatibility so the 2000 still can use it ? Here is a link to the article. All is right for the moment, I shall cherish it at least the SQL2005 world a bit better.

http://www.aspfaq.com/sql2005/show.asp?id=4

Thursday, March 8, 2012

Connection to SQL

I am gettin the following error,,

Exception Details: System.Data.OleDb.OleDbException: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. Invalid connection string attribute

This is the string can anyone help?

Dim DBConn as OleDbConnection
Dim DBCommand As OleDbDataAdapter
Dim DSLogin as New DataSet

DBConn = New OleDbConnection("Provider=sqloledb;" _
& "server=localhost;" _
& "InitialCatalog=BOOKSTORE;" _
& "User Id=sa;" _
& "Password=Pswd:")

DBCommand = New OleDbDataAdapter _
("Select StudentID from " _
& "Students Where " _
& "StudentName = '" & txtStudentName.Text _
& "' and Password = '" & txtPassword.Text _
& "'", DBConn)
DBCommand.Fill(DSLogin, _
"StudentInfo")
If DSLogin.Tables("StudentInfo"). _
Rows.Count = 0 Then
lblMessage.Text = "The student name and password " _
& "were not found. Please try again."
Else
Session("StudentID") = DSLogin.Tables("StudentInfo"). _
Rows(0).Item("StudentID")
Session("StudentName") = txtStudentName.Text
Response.Redirect("./home_room.aspx")
End IfAre you using Mixed mode or windows authentication for sql Server?

Also, I thoght you needed to open the connection first, not totally sure.

Wednesday, March 7, 2012

connection timeout exception dialog

Hi,
When I am trying to open Access 2003 report after SQL server is stopped I
am getting following error:
Microsoft SQL Server Login
Connection failed:
SQL Server Error: 53
SQL Server does not exist or access denied.
Our requirement is to supress this error dialog and instead show customized
msg.
Any pointer how to supress error dialog in SQL msde because of connection
failure will be of great help....
Cheers,
Binod
How are you opening the report? One solution to the problem would be
for the users to NOT open the report directly from the UI, but instead
open it by clicking a button on a form. You can then write code that
tests to see if the connection is still active. If it is, you open the
report. If it isn't, display your custom message.
--Mary
On Thu, 30 Dec 2004 04:59:01 -0800, "Abhi poddar"
<Abhipoddar@.discussions.microsoft.com> wrote:

>Hi,
> When I am trying to open Access 2003 report after SQL server is stopped I
>am getting following error:
>---
>Microsoft SQL Server Login
>---
>Connection failed:
>SQL Server Error: 53
>SQL Server does not exist or access denied.
>---
>Our requirement is to supress this error dialog and instead show customized
>msg.
>Any pointer how to supress error dialog in SQL msde because of connection
>failure will be of great help....
>Cheers,
>Binod