Showing posts with label state. Show all posts
Showing posts with label state. Show all posts

Friday, March 30, 2012

problem with c# stored procedure calling a class

I wrote a stored procedure in c# that calls a class. It deployed fine but when I try to execute it, I get the error...

Msg 6522, Level 16, State 1, Procedure UpdateJobAdSearch, Line 0
A .NET Framework error occurred during execution of user defined routine or aggregate 'UpdateJobAdSearch':
System.Security.SecurityException: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
System.Security.SecurityException:
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.PermissionSet.Demand()
at System.Data.Common.DbConnectionOptions.DemandPermission()
at System.Data.SqlClient.SqlConnection.PermissionDemand()
at System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
at JobAd.WhaleJobAd.CreateSearchableRecord()
at JobAd.WhaleJobAd.CreateSearchableRecord(String JobId)
at StoredProcedures.UpdateJobAdSearch(String JobAdId)

I read an article on MSDN that didn't directly relate, but mentioned the same error message. It suggested using...

System.Data.SqlClient.SqlClientPermission pSql = new SqlClientPermission(System.Security.Permissions.PermissionState.Unrestricted);
pSql.Assert();

I tried that, but I get the same error.

I finally found the answer to this. I needed to set the projects properties > database permission level to external. However, I don't understand why. I've scaled back my code, pulled it out the class so everything executes in the stored procedures method call and all it does it create 2 connections to the local database and pull info from 6 tables and put that info into 1. It's not trying to access anything outside the database, so why does it have to be set to external? In order to get that to work, I had to then alter the database and turn trustworthy on which is scary because of the security holes that opens up.|||

cakewalkr7:

I've scaled back my code, pulled it out the class so everything executes in the stored procedures method call and all it does it create 2 connections to the local database and pull info from 6 tables and put that info into 1.

I think maybe connections opened by the class are considered as access to external resource. Did you try to open a connection in this way?

SqlConnection conn = new SqlConnection("context connection = true");

sql

Wednesday, March 28, 2012

problem with bigints in SS 2000

Anybody know what this error means:
"Server: Msg 3624, Level 20, State 1, Line 1
Location: p:\sql\ntdbms\storeng\drs\include\record.inl:1447
Expression: m_SizeRec > 0 && m_SizeRec <= MAXDATAROW
SPID: 111
Process ID: 2028
Connection Broken"
I have a RESTORED database with about 10 large tables. A simple select
would return a couple of thousand of rows and then suddenly bomb out with
the above error. Interestingly the problem occurs only on the tables that
contain bigint columns, so I'm not sure if it's related. If I run "dbcc
checktable" on these table it returns lots of errors. I'm pretty sure the
database is not corrupt - it happens on any number of machines, plus the
database works fine at its original location. When I try to repair the
restored tables using "checktable" I can only do so with
"repair_allow_data_loss", not a good option of course. Also I have to
remove any indexes I have on the bigint columns. Any ideas?
Thanks
Have you tried using checktable with Repair_Rebuild. If that does not work then I would try deleting the indexes and rechecking then.
Jeff
MCDBA, MCSE+I
|||Hi,
Thanks for the reply. Yes, I have tried that, but it doesn't work - it only
works with "repair_allow_data_loss". Most of the errors are "consistency"
errors. It seems to me the problem lies with the bigint fields, but I'm not
sure why. I'm pretty sure the problem is not related to the indexes,
because only two of the problem tables have indexes. If I drop the indexes,
some of the errors (like "missing parents") go away, but the "consistency"
ones remain.
Tnx,
Pieter
"Jeff Duncan" <jduncan@.gtefcu.org> wrote in message
news:100C38FB-3B9B-43F6-8700-DECF9E014C74@.microsoft.com...
> Have you tried using checktable with Repair_Rebuild. If that does not
work then I would try deleting the indexes and rechecking then.
> Jeff
> MCDBA, MCSE+I

problem with bigints in SS 2000

Anybody know what this error means:
"Server: Msg 3624, Level 20, State 1, Line 1
Location: p:\sql\ntdbms\storeng\drs\include\record.inl:1447
Expression: m_SizeRec > 0 && m_SizeRec <= MAXDATAROW
SPID: 111
Process ID: 2028
Connection Broken"
I have a RESTORED database with about 10 large tables. A simple select
would return a couple of thousand of rows and then suddenly bomb out with
the above error. Interestingly the problem occurs only on the tables that
contain bigint columns, so I'm not sure if it's related. If I run "dbcc
checktable" on these table it returns lots of errors. I'm pretty sure the
database is not corrupt - it happens on any number of machines, plus the
database works fine at its original location. When I try to repair the
restored tables using "checktable" I can only do so with
"repair_allow_data_loss", not a good option of course. Also I have to
remove any indexes I have on the bigint columns. Any ideas?
ThanksHi,
Thanks for the reply. Yes, I have tried that, but it doesn't work - it only
works with "repair_allow_data_loss". Most of the errors are "consistency"
errors. It seems to me the problem lies with the bigint fields, but I'm not
sure why. I'm pretty sure the problem is not related to the indexes,
because only two of the problem tables have indexes. If I drop the indexes,
some of the errors (like "missing parents") go away, but the "consistency"
ones remain.
Tnx,
Pieter
"Jeff Duncan" <jduncan@.gtefcu.org> wrote in message
news:100C38FB-3B9B-43F6-8700-DECF9E014C74@.microsoft.com...
> Have you tried using checktable with Repair_Rebuild. If that does not
work then I would try deleting the indexes and rechecking then.
> Jeff
> MCDBA, MCSE+I

problem with bigints in SS 2000

Anybody know what this error means:
"Server: Msg 3624, Level 20, State 1, Line 1
Location: p:\sql\ntdbms\storeng\drs\include\record
.inl:1447
Expression: m_SizeRec > 0 && m_SizeRec <= MAXDATAROW
SPID: 111
Process ID: 2028
Connection Broken"
I have a RESTORED database with about 10 large tables. A simple select
would return a couple of thousand of rows and then suddenly bomb out with
the above error. Interestingly the problem occurs only on the tables that
contain bigint columns, so I'm not sure if it's related. If I run "dbcc
checktable" on these table it returns lots of errors. I'm pretty sure the
database is not corrupt - it happens on any number of machines, plus the
database works fine at its original location. When I try to repair the
restored tables using "checktable" I can only do so with
"repair_allow_data_loss", not a good option of course. Also I have to
remove any indexes I have on the bigint columns. Any ideas?
ThanksHave you tried using checktable with Repair_Rebuild. If that does not work
then I would try deleting the indexes and rechecking then.
Jeff
MCDBA, MCSE+I|||Hi,
Thanks for the reply. Yes, I have tried that, but it doesn't work - it only
works with "repair_allow_data_loss". Most of the errors are "consistency"
errors. It seems to me the problem lies with the bigint fields, but I'm not
sure why. I'm pretty sure the problem is not related to the indexes,
because only two of the problem tables have indexes. If I drop the indexes,
some of the errors (like "missing parents") go away, but the "consistency"
ones remain.
Tnx,
Pieter
"Jeff Duncan" <jduncan@.gtefcu.org> wrote in message
news:100C38FB-3B9B-43F6-8700-DECF9E014C74@.microsoft.com...
> Have you tried using checktable with Repair_Rebuild. If that does not
work then I would try deleting the indexes and rechecking then.
> Jeff
> MCDBA, MCSE+I

Tuesday, March 20, 2012

Problem while sending mail

Hello,
When i send a mail through the SQL Server mailing stem i sometimes get the
error
Server: Msg 18025, Level 16, State 1, Line 0
xp_sendmail: failed with mail error 0x80070005
Any particular reason for that and how can i solve that?
Thanks in advance
Regards
Ishan
Check out this url
http://support.microsoft.com/default...b;en-us;820220
The SQL Server Home Page is really good for finding out the causes of these
errors.
Cheers,
John - DBA
"Ishan Bhalla" wrote:

> Hello,
> When i send a mail through the SQL Server mailing stem i sometimes get the
> error
> Server: Msg 18025, Level 16, State 1, Line 0
> xp_sendmail: failed with mail error 0x80070005
> Any particular reason for that and how can i solve that?
> Thanks in advance
> Regards
> Ishan
|||"Ishan Bhalla" <IshanBhalla@.discussions.microsoft.com> wrote in message
news:0E2B65EE-8317-4092-9FCE-6954F5204BF7@.microsoft.com...
> When i send a mail through the SQL Server mailing stem i sometimes get
> the
> error
> Server: Msg 18025, Level 16, State 1, Line 0
> xp_sendmail: failed with mail error 0x80070005
Has it worked already or it never worked before?
Regards, Wojtek
|||It used to work before!
It stopped working after we upgraded the mailbox to an Exchange 2003 mailbox.
Regards
Ishan
"Wojtek Garwol" wrote:

> "Ishan Bhalla" <IshanBhalla@.discussions.microsoft.com> wrote in message
> news:0E2B65EE-8317-4092-9FCE-6954F5204BF7@.microsoft.com...
> Has it worked already or it never worked before?
> Regards, Wojtek
>
>

Problem while sending mail

Hello,
When i send a mail through the SQL Server mailing stem i sometimes get the
error
Server: Msg 18025, Level 16, State 1, Line 0
xp_sendmail: failed with mail error 0x80070005
Any particular reason for that and how can i solve that?
Thanks in advance
Regards
IshanCheck out this url
http://support.microsoft.com/defaul...kb;en-us;820220
The SQL Server Home Page is really good for finding out the causes of these
errors.
Cheers,
--
John - DBA
"Ishan Bhalla" wrote:

> Hello,
> When i send a mail through the SQL Server mailing stem i sometimes get the
> error
> Server: Msg 18025, Level 16, State 1, Line 0
> xp_sendmail: failed with mail error 0x80070005
> Any particular reason for that and how can i solve that?
> Thanks in advance
> Regards
> Ishan|||"Ishan Bhalla" <IshanBhalla@.discussions.microsoft.com> wrote in message
news:0E2B65EE-8317-4092-9FCE-6954F5204BF7@.microsoft.com...
> When i send a mail through the SQL Server mailing stem i sometimes get
> the
> error
> Server: Msg 18025, Level 16, State 1, Line 0
> xp_sendmail: failed with mail error 0x80070005
Has it worked already or it never worked before?
Regards, Wojtek|||It used to work before!
It stopped working after we upgraded the mailbox to an Exchange 2003 mailbox
.
Regards
Ishan
"Wojtek Garwol" wrote:

> "Ishan Bhalla" <IshanBhalla@.discussions.microsoft.com> wrote in message
> news:0E2B65EE-8317-4092-9FCE-6954F5204BF7@.microsoft.com...
> Has it worked already or it never worked before?
> Regards, Wojtek
>
>

Problem while sending mail

Hello,
When i send a mail through the SQL Server mailing stem i sometimes get the
error
Server: Msg 18025, Level 16, State 1, Line 0
xp_sendmail: failed with mail error 0x80070005
Any particular reason for that and how can i solve that?
Thanks in advance
Regards
IshanCheck out this url
http://support.microsoft.com/default.aspx?scid=kb;en-us;820220
The SQL Server Home Page is really good for finding out the causes of these
errors.
Cheers,
--
John - DBA
"Ishan Bhalla" wrote:
> Hello,
> When i send a mail through the SQL Server mailing stem i sometimes get the
> error
> Server: Msg 18025, Level 16, State 1, Line 0
> xp_sendmail: failed with mail error 0x80070005
> Any particular reason for that and how can i solve that?
> Thanks in advance
> Regards
> Ishan|||"Ishan Bhalla" <IshanBhalla@.discussions.microsoft.com> wrote in message
news:0E2B65EE-8317-4092-9FCE-6954F5204BF7@.microsoft.com...
> When i send a mail through the SQL Server mailing stem i sometimes get
> the
> error
> Server: Msg 18025, Level 16, State 1, Line 0
> xp_sendmail: failed with mail error 0x80070005
Has it worked already or it never worked before?
Regards, Wojtek|||It used to work before!
It stopped working after we upgraded the mailbox to an Exchange 2003 mailbox.
Regards
Ishan
"Wojtek Garwol" wrote:
> "Ishan Bhalla" <IshanBhalla@.discussions.microsoft.com> wrote in message
> news:0E2B65EE-8317-4092-9FCE-6954F5204BF7@.microsoft.com...
> > When i send a mail through the SQL Server mailing stem i sometimes get
> > the
> > error
> >
> > Server: Msg 18025, Level 16, State 1, Line 0
> > xp_sendmail: failed with mail error 0x80070005
> Has it worked already or it never worked before?
> Regards, Wojtek
>
>

Friday, March 9, 2012

Problem when connecting from remote location to SQL Server 2k SP 3

This is when using SA account trying the SQL Query
Analyzer. I get the error Msg 17, Level 16, State 1. I
can locally connect fine on the server itself using SQL
Query Analyzer. I'm using SQL Authentication.
When trying to connect I get:
Unable to connect to server (name of server)
Server: Msg 17, Level 16, State 1
[Microsoft][ODBC SQL Server Driver][DBNETLIB] SQL Server
does not exist or access denied.
I verified that the port is open on the firewall pointing
to the server. Also, this just started happening and was
working fine before. I've reset the SA password and
verified that I am putting in either the DNS entry or IP
address and get the same error. Any help diagnosing this
is greatly appreciated!
Hi Luke,
Try running the following command using ISQL.exe
ISQL -Stcp:ServerNameHere -Usa -Ppassword -Q"select @.@.version"
Look for the OS Error returned. This will help you troubleshoot the
problem.
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.
|||When I run that command, I get the following:
DB-Library: Unable to connect: SQL Server is unavailable
or does not exist. Una
ble to connect: SQL Server does not exist or network
access denied.
Net-Library error 10061: ConnectionOpen (Connect()).
This is when running on the server. I can't connect
remotely of course.
|||Hi Luke,
The actual error is : 10061:
This means that the server is not listening on the port.
Restart MSSQLServer and verify that SQL is listening.
Check the NT Application logs and SQL Errorlogs. For SQL 2000 we print
this in the errorlog.
Also you can verify this by running netstat -an at the command prompt.
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.

Problem when connecting from remote location to SQL Server 2k SP 3

This is when using SA account trying the SQL Query
Analyzer. I get the error Msg 17, Level 16, State 1. I
can locally connect fine on the server itself using SQL
Query Analyzer. I'm using SQL Authentication.
When trying to connect I get:
Unable to connect to server (name of server)
Server: Msg 17, Level 16, State 1
[Microsoft][ODBC SQL Server Driver][DBNETLIB] SQL Server
does not exist or access denied.
I verified that the port is open on the firewall pointing
to the server. Also, this just started happening and was
working fine before. I've reset the SA password and
verified that I am putting in either the DNS entry or IP
address and get the same error. Any help diagnosing this
is greatly appreciated!Hi Luke,
Try running the following command using ISQL.exe
ISQL -Stcp:ServerNameHere -Usa -Ppassword -Q"select @.@.version"
Look for the OS Error returned. This will help you troubleshoot the
problem.
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.|||When I run that command, I get the following:
DB-Library: Unable to connect: SQL Server is unavailable
or does not exist. Una
ble to connect: SQL Server does not exist or network
access denied.
Net-Library error 10061: ConnectionOpen (Connect()).
This is when running on the server. I can't connect
remotely of course.|||Hi Luke,
The actual error is : 10061:
This means that the server is not listening on the port.
Restart MSSQLServer and verify that SQL is listening.
Check the NT Application logs and SQL Errorlogs. For SQL 2000 we print
this in the errorlog.
Also you can verify this by running netstat -an at the command prompt.
Thanks,
Kevin McDonnell
Microsoft Corporation
This posting is provided AS IS with no warranties, and confers no rights.