Transactions And Exceptions
Dec 10, 2005
I am a novice with SQL, and I am failing to understand an aspect of Transactions.
The following is the code I have created, having referred to a handful of resources including MSDN documentation.
public void CreateSection(Section section)
{
string sql =
@"INSERT INTO sectiontable (nodeid, title)
VALUES (@nodeid, @title)
SELECT Scope_Identity() FROM sectiontable";
SqlConnection connection = new SqlConnection(this.connectionString);
SqlCommand command = new SqlCommand(sql, connection);
command.Parameters.AddWithValue("@nodeid", section.Node.Id);
command.Parameters.AddWithValue("@title", section.Title);
connection.Open();
SqlTransaction transaction = connection.BeginTransaction();
try
{
command.Transaction = transaction;
object result = command.ExecuteScalar();
if (result == null)
throw new DataException("Returned identity was invalid.");
section.Id = Convert.ToInt32(result);
transaction.Commit();
}
catch (Exception exception)
{
string message = "Could not create section.";
try
{
transaction.Rollback();
message += " Transaction was reversed.";
}
catch (SqlException booboo)
{
message += " An exception of type " + booboo.GetType();
message += " occurred while attempting to roll back the transaction.";
}
// Note: DataAccessException below is a custom class.
throw new DataAccessException(message, exception);
}
finally
{
connection.Close();
}
}
What seems clumsy is that we must have connection.Open() outside the try-catch block. The following cannot work, because the compiler notes the "Use of unassigned local variable 'transaction'" at the location shown below:
SqlConnection connection = new SqlConnection(this.connectionString);
SqlTransaction transaction;
try
{
connection.Open();
transaction = connection.BeginTransaction();
// commands execute
transaction.Commit();
}
catch (Exception exception)
{
transaction.Rollback(); // <-- Compiler notes use of unassigned variable.
// (First testing the variable does not help.)
// handle exception.
}
finally
{
connection.Close();
}
The following also does not work, as the BeginTransaction() method must be called against an open connection.
SqlConnection connection = new SqlConnection(this.connectionString);
SqlTransaction transaction = connection.BeginTransaction();
try
{
connection.Open();
// commands execute
transaction.Commit();
}
catch (Exception exception)
{
transaction.Rollback();
// handle exception.
}
finally
{
connection.Close();
}
So, in MSDN documentation, the connection.Open() method is called outside the try-catch block (as shown in my full code). Yet, that same documentation notes that this method can lead to two types of exceptions. So it seems that the use of transactions forces an exception-throwing method to be used outside of a try-catch block. My question, then: is this unavoidable?
View 3 Replies
ADVERTISEMENT
Nov 1, 2006
if i have a loop that runs through records in a dataset like thisfor(int i=0;i<ds.Tables[0].Rows.Count;++i) and in this loop i have several sql commands that run as a transaction in a try / catch block like : try{ // do stuff}catch{ trans.RollBack();}how can i keep the loop going even if a transaction failed. So the transaction works for each individual row. if row 100 fails for whatever i would like the loop to continue running, do i just simply remove the "throw" and it will continue looping ? my catch block currently looks like catch(Exception ex){transaction.Rollback();activity.Log("Transaction aborted, rolling back. Error Message: " + ex.Message + " Stack Trace: " + ex.StackTrace.ToString());throw; }thanks,mcm
View 4 Replies
View Related
Sep 28, 2006
Hi,
Using RAISERROR from within a stored prcedure will result in a SQLException being thrown at the client side of a JDBC connection.
I am trying to provide a meaningfull error message to be shown to the end user. However, all exceptions thrown will inevitably start with : "[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]". The following questions then arise :
- Is there a way of configuring SQL Server not to display this header ?
alternatively,
- Is there another way of conveying error messages to the client through JDBC ?
Thank you for your answers,
Ben
View 1 Replies
View Related
May 22, 2005
Hi there,
I have decided to move all my transaction handling from asp.net to stored procedures in a SQL Server 2000 database. I know the database is capable of rolling back the transactions just like myTransaction.Rollback() in asp.net. But what about exceptions? In asp.net, I am used to doing the following:
<code>Try 'execute commands myTransaction.Commit()Catch ex As Exception Response.Write(ex.Message) myTransaction.Rollback()End Try</code>Will the database inform me of any exceptions (and their messages)? Do I need to put anything explicit in my stored procedure other than rollback transaction?
Any help is greatly appreciated
View 3 Replies
View Related
Jan 22, 2008
I'm sure that the try part of following code are all executedand the session("isLogin") has set to Truebut it always catch a exceptionand redirect to error1.aspx can't figure it out 1 Try
2 mySqlCon = New SqlConnection(strMySqlCon)
3 mySqlCmd = New SqlCommand(strMySqlCmd, mySqlCon)
4
5 mySqlCon.Open()
6 myDataReader = mySqlCmd.ExecuteReader()
7
8 If myDataReader.Read() = True Then
9
10
11 webPwdMd5 = System.Web.Security.FormsAuthentication. _
12 HashPasswordForStoringInConfigFile(Me.TextBox1.Text, "MD5")
13
14 If webPwdMd5 = myDataReader.Item("password") Then
15 Session("isLogin") = True
16 'Me.TextBox1.Text = "ppp"
17 Response.Redirect("main.aspx")
18 Else
19 Session("islogin") = False
20 Me.Label1.Visible = True
21 End If
22 Else
23 Session("isLogin") = False
24 Me.Label1.Visible = True
25 End If
26
27 mySqlCon.Close()
28
29 Catch Myexception As Exception
30 Session("isLogin") = False
31 Response.Redirect("error1.aspx")
32
33 Finally
34
35 End Try
View 2 Replies
View Related
Aug 23, 2001
we are converting Informix Stored procedures to SQL Server stored
procedures..
In Informix they have handled the exceptions as shown below,
ON EXCEPTION
LET @l_status = 1;
RETURN @l_delete,@l_status;
END EXCEPTION
We have to convert this to the corresponding SQL server statements..
How to ahbdle exceptions in SQL Server.
View 1 Replies
View Related
Jan 11, 2007
Vikas writes "can any one help me in getting the list of exceptions and there types and how to tackle them."
View 1 Replies
View Related
Nov 29, 2006
Hi,
How should one deal with exceptions generated by the DTS to SSIS conversion wizard in sql server 2005?
Thanks
View 1 Replies
View Related
Jan 9, 2006
Friends,
First off, congrats and thank you to everyone at Microsoft for all of the hard work they have put into Sql Server 2005 and .NET 2.0 - it is simply amazing technology.
On that note, I was wondering if it was possible to create my own custom exceptions that I can throw in my stored procedures and then catch in my application code?
For example, say I wanted to create a Custom Sql Exception called "DuplicateEmailInSqlDatabaseTableException" and then, within a stored procedure where data is being attempted to be inserted, I could check for a duplicate email record and then throw the exception. At that point, I would like to be able to catch that exception in my C# data layer and work from there.
Is this possible? I feel like it could be but am unsure where to start.
Shaun C McDonnell
View 5 Replies
View Related
Jan 3, 2008
I am trying to write a query that will only give me the data that is not in both queries. I need a query that will give me the data that is in the first query but not in the second query. I tried a union but that does not work. The date and PosType are important.
SELECT Symbol,PosType,HistDate
FROM EntityView
WHERE Histdate >'01/01/07' and PosType = 'S'
union
SELECT Symbol,PosType,HistDate
FROM EntityView
WHERE Histdate >'01/01/07' and PosType = 'S' and EntityCode = 'HIS'
View 3 Replies
View Related
Jul 22, 2006
So I have some SQLCLR stored procedures, that use some .NET classes. I have a table in the database for exceptions, and I want to log all exceptions (except SqlExceptions of course) to that table.
I have the following example:
public partial class UserDefinedFunctions
{
[Microsoft.SqlServer.Server.SqlFunction(FillRowMethodName = "FillRow2", DataAccess = DataAccessKind.None, SystemDataAccess = SystemDataAccessKind.Read,
TableDefinition = "fld_colname NVARCHAR(4000)")]
public static IEnumerable ExceptionTest()
{
// Some example from a website
List<string> names = new List<string>();
using (SqlConnection connection = new SqlConnection("context connection=true"))
{
connection.Open();
SqlCommand sqlCommand = connection.CreateCommand();
sqlCommand.CommandText = "select NAME from dbo.SYSCOLUMNS";
SqlDataReader sqlDataReader = sqlCommand.ExecuteReader(); // No exceptions
while (sqlDataReader.Read())
{
names.Add(sqlDataReader.GetValue(0).ToString()); // This works fine
}
Exception e = new Exception("foo");
MyExceptionLoggingClass.Log(e,connection); // This doesn't
}
return names;
}
public static void FillRow2(object row, out string str2)
{
str2 = (string)row;
}
}
public class MyExceptionLoggingClass
{
public static void Log(Exception ex, SqlConnection conn)
{
LogException(ex, conn);
}
private static void LogException(Exception ex, SqlConnection connection)
{
SqlCommand cmd = new SqlCommand("LogException", connection);
cmd.CommandType = System.Data.CommandType.StoredProcedure;
SqlParameter param = new SqlParameter("@message", ex.Message);
cmd.Parameters.Add(param);
param = new SqlParameter("@stackTrace", "test");
cmd.Parameters.Add(param);
param = new SqlParameter("@localtime", DateTime.UtcNow);
cmd.Parameters.Add(param);
try
{
cmd.ExecuteNonQuery(); // always throws IOE, as does SqlContext.Pipe.ExecuteAndSend(cmd);
}
catch (InvalidOperationException)
{
return;
}
}
The exception is: _COMPlusExceptionCode = -532459699 (couldn't find anything useful on that)
Ideally I don't want to be passing the connection to my class all the time, which is why I wanted to have overloaded methods, some that take the connection, others that don't, and open their own. Neither scenario works unfortunately.
If I run the code under LogException in my caller class (ExceptionTest) it works fine (I mean doesn't throw this exception, but I can't call from a SqlFunction - different issue, SQLCLR restriction).
I've been trying to debug this for a while now, and I'm running out of ideas, so any suggestion(s) would be highly appreciated.
Thanks!
View 17 Replies
View Related
Dec 26, 2006
I have StratDateTime and EndDateTime fields in the table. I need to compare this two datetime fields and find seconds. I can use DateDiff but there are the following exceptions:
1. Exclude seconds coming from the date which are Saturday and Sunday
2. Exclude seconds coming from time range between 7:01pm and 6:59am
3. Exclude seconds coming from Jan 1st and Jul 4th.
How can I do this?
View 3 Replies
View Related
Sep 28, 2007
Hi there,
We are running into problems using CLR stored procedure in SQL Server 2005.
We are using a transaction scope (ambient transaction).
If an SQL exception with class 16 is thrown, and this exception is directly caught (and handled) then the transaction is somehow no longer valid.
Subsequent use of this transaction gives the message "The current transaction cannot be committed and cannot support operations that write to the log file. Rollback the transaction".
Is there a way to gracefully handle the SqlException and continue the transaction?
Regards,
Frans Z. and Rine le C.
View 1 Replies
View Related
Jan 3, 2008
To preface, I am trying to get a notification in a client side app from SQL Server 2005 (Express) when a datatable changes. The problem is I am getting these exceptions and I have no idea what is causing them, if it is a serious problem, or how to debug it from here.
Here is the setup:
I am working with SqlDependency in .NET 2.0 and running a simple app that just calls start and stop on the dependency object. The result is 3 exceptions in System.Data.Dll
A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll
Additional information: A severe error occurred on the current command. The results, if any, should be discarded.
Operation cancelled by user.
A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll
Additional information: A severe error occurred on the current command. The results, if any, should be discarded.'
Operation cancelled by user.
A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll
Additional information: A severe error occurred on the current command. The results, if any, should be discarded.
Operation cancelled by user.
To duplicate this problem, do the following:
1) Create a database on SQL Server 2005 Express
2) Make sure the database has "ENABLE_BROKER" set.
(ALTER DATABASE <DataBase> SET ENABLE_BROKER).
3) Turn on CLR exceptions in your debugger (debug->Exceptions->Common Language Runtime Exceptions)
4) Create a C# windows app. Add the following in form1_load.
string connectstring = "Server=<SERVER>;Integrated security=true;database=<DATABASE>";
SqlDependency.Start(connectstring);
SqlDependency.Stop(connectstring);
5) Add using System.Data.SqlClient at the top of form1.cs
6) Run the app.
-Kent
View 4 Replies
View Related
May 26, 2007
HI everyone,
I have written security extension for forms authentication. Apparantly every thing is working fine, I can log on to the report server, view reports, etc without any problem. But i see few exceptions in my log files. The following log was generated even before i logged on to the reporting service:
<Header>
<Product>Microsoft SQL Server Reporting Services Version 9.00.3042.00</Product>
<Locale>en-US</Locale>
<TimeZone>West Asia Standard Time</TimeZone>
<Path>C:Program FilesMicrosoft SQL ServerMSSQL.4Reporting ServicesLogFilesReportServer__05_26_2007_18_04_56.log</Path>
<SystemName>NAVEEDSIDDIQUI</SystemName>
<OSName>Microsoft Windows NT 5.1.2600 Service Pack 2</OSName>
<OSVersion>5.1.2600.131072</OSVersion>
</Header>
aspnet_wp!webserver!1e!5/26/2007-18:04:57:: i INFO: Reporting Web Server started
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing ConnectionType to '1' as specified in Configuration file.
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing IsSchedulingService to 'True' as specified in Configuration file.
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing IsNotificationService to 'True' as specified in Configuration file.
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing IsEventService to 'True' as specified in Configuration file.
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing PollingInterval to '10' second(s) as specified in Configuration file.
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing WindowsServiceUseFileShareStorage to 'False' as specified in Configuration file.
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing MemoryLimit to '60' percent as specified in Configuration file.
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing RecycleTime to '720' minute(s) as specified in Configuration file.
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing MaximumMemoryLimit to '80' percent as specified in Configuration file.
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing MaxAppDomainUnloadTime to '30' minute(s) as specified in Configuration file.
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing MaxQueueThreads to '0' thread(s) as specified in Configuration file.
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing IsWebServiceEnabled to 'True' as specified in Configuration file.
aspnet_wp!configmanager!1e!5/26/2007-18:04:57:: w WARN: WebServiceAccount is not specified in the config file. Using default: NAVEEDSIDDIQUIASPNET
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing MaxActiveReqForOneUser to '20' requests(s) as specified in Configuration file.
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing MaxScheduleWait to '5' second(s) as specified in Configuration file.
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing DatabaseQueryTimeout to '120' second(s) as specified in Configuration file.
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing ProcessRecycleOptions to '0' as specified in Configuration file.
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing RunningRequestsScavengerCycle to '60' second(s) as specified in Configuration file.
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing RunningRequestsDbCycle to '60' second(s) as specified in Configuration file.
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing RunningRequestsAge to '30' second(s) as specified in Configuration file.
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing CleanupCycleMinutes to '10' minute(s) as specified in Configuration file.
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing DailyCleanupMinuteOfDay to default value of '120' minutes since midnight because it was not specified in Configuration file.
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing WatsonFlags to '1064' as specified in Configuration file.
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing WatsonDumpOnExceptions to 'Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException,Microsoft.ReportingServices.Modeling.InternalModelingException' as specified in Configuration file.
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing WatsonDumpExcludeIfContainsExceptions to 'System.Data.SqlClient.SqlException,System.Threading.ThreadAbortException' as specified in Configuration file.
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing SecureConnectionLevel to '0' as specified in Configuration file.
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing DisplayErrorLink to 'True' as specified in Configuration file.
aspnet_wp!library!1e!5/26/2007-18:04:57:: i INFO: Initializing WebServiceUseFileShareStorage to 'False' as specified in Configuration file.
aspnet_wp!resourceutilities!1e!5/26/2007-18:04:57:: i INFO: Reporting Services starting SKU: Developer
aspnet_wp!resourceutilities!1e!5/26/2007-18:04:57:: i INFO: Evaluation copy: 0 days left
aspnet_wp!runningjobs!1e!5/26/2007-18:04:57:: i INFO: Database Cleanup (Web Service) timer enabled: Next Event: 600 seconds. Cycle: 600 seconds
aspnet_wp!runningjobs!1e!5/26/2007-18:04:57:: i INFO: Running Requests Scavenger timer enabled: Next Event: 60 seconds. Cycle: 60 seconds
aspnet_wp!runningjobs!1e!5/26/2007-18:04:57:: i INFO: Running Requests DB timer enabled: Next Event: 60 seconds. Cycle: 60 seconds
aspnet_wp!runningjobs!1e!5/26/2007-18:04:57:: i INFO: Memory stats update timer enabled: Next Event: 60 seconds. Cycle: 60 seconds
aspnet_wp!library!1e!05/26/2007-18:04:58:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details., ;
Info: Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.ReportingServices.WebServer.WebServiceHelper.ConstructRSServiceObjectFromSecurityExtension()
at Microsoft.ReportingServices.WebServer.Global.ConstructRSServiceFromRequest(String item)
at Microsoft.ReportingServices.WebServer.Global.get_Service()
at Microsoft.ReportingServices.WebServer.Global.DispatchRequest(Boolean& transferedToViewerPage)
at Microsoft.ReportingServices.WebServer.Global.Application_AuthenticateRequest(Object sender, EventArgs e)
--- End of inner exception stack trace ---
aspnet_wp!library!1e!05/26/2007-18:05:06:: i INFO: Exception dumped to: C:Program FilesMicrosoft SQL ServerMSSQL.4Reporting ServicesLogFiles flags= ReferencedMemory, AllThreads, SendToWatson
aspnet_wp!library!1e!05/26/2007-18:05:06:: i INFO: Catalog SQL Server Edition = Developer
aspnet_wp!library!1e!05/26/2007-18:05:07:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details., ;
Info: Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.ReportingServices.WebServer.WebServiceHelper.ConstructRSServiceObjectFromSecurityExtension()
at Microsoft.ReportingServices.WebServer.Global.ConstructRSServiceFromRequest(String item)
at Microsoft.ReportingServices.WebServer.Global.get_Service()
at Microsoft.ReportingServices.WebServer.Global.DispatchRequest(Boolean& transferedToViewerPage)
at Microsoft.ReportingServices.WebServer.Global.Application_AuthenticateRequest(Object sender, EventArgs e)
--- End of inner exception stack trace ---
aspnet_wp!library!1e!05/26/2007-18:05:07:: i INFO: Exception dumped to: C:Program FilesMicrosoft SQL ServerMSSQL.4Reporting ServicesLogFiles flags= ReferencedMemory, AllThreads, SendToWatson
aspnet_wp!library!1!05/26/2007-18:05:19:: Call to GetPermissionsAction(/).
aspnet_wp!library!1!05/26/2007-18:05:19:: Call to GetPropertiesAction(/, PathBased).
aspnet_wp!library!1!05/26/2007-18:05:20:: Call to GetSystemPermissionsAction().
aspnet_wp!library!1!05/26/2007-18:05:20:: Call to ListChildrenAction(/, False).
aspnet_wp!library!1!05/26/2007-18:05:20:: Call to GetSystemPropertiesAction().
aspnet_wp!library!1!05/26/2007-18:05:20:: Call to GetSystemPropertiesAction().
aspnet_wp!library!c!05/26/2007-18:05:29:: Call to GetPermissionsAction(/Reports).
aspnet_wp!library!c!05/26/2007-18:05:29:: Call to GetPropertiesAction(/Reports, PathBased).
aspnet_wp!library!c!05/26/2007-18:05:29:: Call to GetSystemPermissionsAction().
aspnet_wp!library!c!05/26/2007-18:05:29:: Call to ListChildrenAction(/Reports, False).
aspnet_wp!library!c!05/26/2007-18:05:29:: Call to GetSystemPropertiesAction().
aspnet_wp!library!c!05/26/2007-18:05:29:: Call to GetSystemPropertiesAction().
aspnet_wp!library!1!05/26/2007-18:05:32:: Call to GetPermissionsAction(/Reports/Balance).
aspnet_wp!library!1!05/26/2007-18:05:32:: Call to GetSystemPropertiesAction().
aspnet_wp!library!1!05/26/2007-18:05:32:: Call to GetPropertiesAction(/Reports/Balance, PathBased).
aspnet_wp!library!1!05/26/2007-18:05:33:: Call to GetSystemPermissionsAction().
aspnet_wp!library!1!05/26/2007-18:05:33:: Call to GetPropertiesAction(/Reports/Balance, PathBased).
aspnet_wp!library!1!05/26/2007-18:05:34:: Call to ListEventsAction().
aspnet_wp!library!1!05/26/2007-18:05:34:: Unhandled exception was caught: System.Web.HttpParseException: Could not load type 'Vantage.VantageILM.RSExtensionLibrary.Logon'. ---> System.Exception: Could not load type 'Vantage.VantageILM.RSExtensionLibrary.Logon'. ---> System.Exception: Could not load type 'Vantage.VantageILM.RSExtensionLibrary.Logon'. ---> System.Web.HttpException: Could not load type 'Vantage.VantageILM.RSExtensionLibrary.Logon'.
at System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError)
at System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly)
at System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData)
--- End of inner exception stack trace ---
at System.Web.UI.TemplateParser.ProcessException(Exception ex)
at System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData)
at System.Web.UI.PageParser.PostProcessMainDirectiveAttributes(IDictionary parseData)
at System.Web.UI.TemplateParser.ProcessMainDirective(IDictionary mainDirective)
at System.Web.UI.TemplateControlParser.ProcessMainDirective(IDictionary mainDirective)
at System.Web.UI.PageParser.ProcessMainDirective(IDictionary mainDirective)
at System.Web.UI.TemplateParser.ProcessDirective(String directiveName, IDictionary directive)
at System.Web.UI.BaseTemplateParser.ProcessDirective(String directiveName, IDictionary directive)
at System.Web.UI.TemplateControlParser.ProcessDirective(String directiveName, IDictionary directive)
at System.Web.UI.PageParser.ProcessDirective(String directiveName, IDictionary directive)
at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
--- End of inner exception stack trace ---
at System.Web.UI.TemplateParser.ProcessException(Exception ex)
at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
--- End of inner exception stack trace ---
at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)
at System.Web.UI.TemplateParser.ParseInternal()
at System.Web.UI.TemplateParser.Parse()
at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()
at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)
at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert)
at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert)
at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
at System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig)
at System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
aspnet_wp!library!1!05/26/2007-18:05:34:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details., ;
Info: Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details. ---> System.Web.HttpParseException: Could not load type 'Vantage.VantageILM.RSExtensionLibrary.Logon'. ---> System.Exception: Could not load type 'Vantage.VantageILM.RSExtensionLibrary.Logon'. ---> System.Exception: Could not load type 'Vantage.VantageILM.RSExtensionLibrary.Logon'. ---> System.Web.HttpException: Could not load type 'Vantage.VantageILM.RSExtensionLibrary.Logon'.
at System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError)
at System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly)
at System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData)
--- End of inner exception stack trace ---
at System.Web.UI.TemplateParser.ProcessException(Exception ex)
at System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData)
at System.Web.UI.PageParser.PostProcessMainDirectiveAttributes(IDictionary parseData)
at System.Web.UI.TemplateParser.ProcessMainDirective(IDictionary mainDirective)
at System.Web.UI.TemplateControlParser.ProcessMainDirective(IDictionary mainDirective)
at System.Web.UI.PageParser.ProcessMainDirective(IDictionary mainDirective)
at System.Web.UI.TemplateParser.ProcessDirective(String directiveName, IDictionary directive)
at System.Web.UI.BaseTemplateParser.ProcessDirective(String directiveName, IDictionary directive)
at System.Web.UI.TemplateControlParser.ProcessDirective(String directiveName, IDictionary directive)
at System.Web.UI.PageParser.ProcessDirective(String directiveName, IDictionary directive)
at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
--- End of inner exception stack trace ---
at System.Web.UI.TemplateParser.ProcessException(Exception ex)
at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
--- End of inner exception stack trace ---
at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
at System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)
at System.Web.UI.TemplateParser.ParseInternal()
at System.Web.UI.TemplateParser.Parse()
at System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()
at System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)
at System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
at System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert)
at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert)
at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
at System.Web.UI.PageHandlerFactory.System.Web.IHttpHandlerFactory2.GetHandler(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
at System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig)
at System.Web.HttpApplication.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
--- End of inner exception stack trace ---
aspnet_wp!library!1!05/26/2007-18:06:05:: i INFO: Exception dumped to: C:Program FilesMicrosoft SQL ServerMSSQL.4Reporting ServicesLogFiles flags= ReferencedMemory, AllThreads, SendToWatson
aspnet_wp!library!1!05/26/2007-18:06:05:: Call to GetSystemPropertiesAction().
aspnet_wp!library!c!05/26/2007-18:09:02:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details., ;
Info: Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.ReportingServices.WebServer.WebServiceHelper.ConstructRSServiceObjectFromSecurityExtension()
at Microsoft.ReportingServices.WebServer.Global.ConstructRSServiceFromRequest(String item)
at Microsoft.ReportingServices.WebServer.Global.get_Service()
at Microsoft.ReportingServices.WebServer.Global.DispatchRequest(Boolean& transferedToViewerPage)
at Microsoft.ReportingServices.WebServer.Global.Application_AuthenticateRequest(Object sender, EventArgs e)
--- End of inner exception stack trace ---
aspnet_wp!library!c!05/26/2007-18:09:36:: i INFO: Exception dumped to: C:Program FilesMicrosoft SQL ServerMSSQL.4Reporting ServicesLogFiles flags= ReferencedMemory, AllThreads, SendToWatson
aspnet_wp!library!c!05/26/2007-18:09:36:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details., ;
Info: Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.ReportingServices.WebServer.WebServiceHelper.ConstructRSServiceObjectFromSecurityExtension()
at Microsoft.ReportingServices.WebServer.Global.ConstructRSServiceFromRequest(String item)
at Microsoft.ReportingServices.WebServer.Global.get_Service()
at Microsoft.ReportingServices.WebServer.Global.DispatchRequest(Boolean& transferedToViewerPage)
at Microsoft.ReportingServices.WebServer.Global.Application_AuthenticateRequest(Object sender, EventArgs e)
--- End of inner exception stack trace ---
aspnet_wp!library!c!05/26/2007-18:10:07:: i INFO: Exception dumped to: C:Program FilesMicrosoft SQL ServerMSSQL.4Reporting ServicesLogFiles flags= ReferencedMemory, AllThreads, SendToWatson
aspnet_wp!library!16!5/26/2007-18:14:57:: i INFO: Cleaned 0 batch records, 0 policies, 0 sessions, 0 cache entries, 0 snapshots, 0 chunks, 0 running jobs, 0 persisted streams
aspnet_wp!library!a!05/26/2007-18:19:58:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details., ;
Info: Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.ReportingServices.WebServer.WebServiceHelper.ConstructRSServiceObjectFromSecurityExtension()
at Microsoft.ReportingServices.WebServer.Global.ConstructRSServiceFromRequest(String item)
at Microsoft.ReportingServices.WebServer.Global.get_Service()
at Microsoft.ReportingServices.WebServer.Global.DispatchRequest(Boolean& transferedToViewerPage)
at Microsoft.ReportingServices.WebServer.Global.Application_AuthenticateRequest(Object sender, EventArgs e)
--- End of inner exception stack trace ---
aspnet_wp!library!a!05/26/2007-18:20:29:: i INFO: Exception dumped to: C:Program FilesMicrosoft SQL ServerMSSQL.4Reporting ServicesLogFiles flags= ReferencedMemory, AllThreads, SendToWatson
aspnet_wp!library!a!05/26/2007-18:20:29:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details., ;
Info: Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.ReportingServices.WebServer.WebServiceHelper.ConstructRSServiceObjectFromSecurityExtension()
at Microsoft.ReportingServices.WebServer.Global.ConstructRSServiceFromRequest(String item)
at Microsoft.ReportingServices.WebServer.Global.get_Service()
at Microsoft.ReportingServices.WebServer.Global.DispatchRequest(Boolean& transferedToViewerPage)
at Microsoft.ReportingServices.WebServer.Global.Application_AuthenticateRequest(Object sender, EventArgs e)
--- End of inner exception stack trace ---
aspnet_wp!library!a!05/26/2007-18:21:00:: i INFO: Exception dumped to: C:Program FilesMicrosoft SQL ServerMSSQL.4Reporting ServicesLogFiles flags= ReferencedMemory, AllThreads, SendToWatson
aspnet_wp!library!16!5/26/2007-18:24:57:: i INFO: Cleaned 0 batch records, 0 policies, 0 sessions, 0 cache entries, 0 snapshots, 0 chunks, 0 running jobs, 0 persisted streams
aspnet_wp!library!1e!05/26/2007-18:27:16:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details., ;
Info: Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.ReportingServices.WebServer.WebServiceHelper.ConstructRSServiceObjectFromSecurityExtension()
at Microsoft.ReportingServices.WebServer.Global.ConstructRSServiceFromRequest(String item)
at Microsoft.ReportingServices.WebServer.Global.get_Service()
at Microsoft.ReportingServices.WebServer.Global.DispatchRequest(Boolean& transferedToViewerPage)
at Microsoft.ReportingServices.WebServer.Global.Application_AuthenticateRequest(Object sender, EventArgs e)
--- End of inner exception stack trace ---
aspnet_wp!library!1e!05/26/2007-18:27:17:: i INFO: Exception dumped to: C:Program FilesMicrosoft SQL ServerMSSQL.4Reporting ServicesLogFiles flags= ReferencedMemory, AllThreads, SendToWatson
aspnet_wp!library!1e!05/26/2007-18:27:17:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details., ;
Info: Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.ReportingServices.WebServer.WebServiceHelper.ConstructRSServiceObjectFromSecurityExtension()
at Microsoft.ReportingServices.WebServer.Global.ConstructRSServiceFromRequest(String item)
at Microsoft.ReportingServices.WebServer.Global.get_Service()
at Microsoft.ReportingServices.WebServer.Global.DispatchRequest(Boolean& transferedToViewerPage)
at Microsoft.ReportingServices.WebServer.Global.Application_AuthenticateRequest(Object sender, EventArgs e)
--- End of inner exception stack trace ---
aspnet_wp!library!1e!05/26/2007-18:27:17:: i INFO: Exception dumped to: C:Program FilesMicrosoft SQL ServerMSSQL.4Reporting ServicesLogFiles flags= ReferencedMemory, AllThreads, SendToWatson
aspnet_wp!library!1e!05/26/2007-18:27:49:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details., ;
Info: Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.ReportingServices.WebServer.WebServiceHelper.ConstructRSServiceObjectFromSecurityExtension()
at Microsoft.ReportingServices.WebServer.Global.ConstructRSServiceFromRequest(String item)
at Microsoft.ReportingServices.WebServer.Global.get_Service()
at Microsoft.ReportingServices.WebServer.Global.DispatchRequest(Boolean& transferedToViewerPage)
at Microsoft.ReportingServices.WebServer.Global.Application_AuthenticateRequest(Object sender, EventArgs e)
--- End of inner exception stack trace ---
aspnet_wp!library!1e!05/26/2007-18:27:49:: i INFO: Exception dumped to: C:Program FilesMicrosoft SQL ServerMSSQL.4Reporting ServicesLogFiles flags= ReferencedMemory, AllThreads, SendToWatson
aspnet_wp!library!1e!05/26/2007-18:27:49:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details., ;
Info: Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details. ---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.ReportingServices.WebServer.WebServiceHelper.ConstructRSServiceObjectFromSecurityExtension()
at Microsoft.ReportingServices.WebServer.Global.ConstructRSServiceFromRequest(String item)
at Microsoft.ReportingServices.WebServer.Global.get_Service()
at Microsoft.ReportingServices.WebServer.Global.DispatchRequest(Boolean& transferedToViewerPage)
at Microsoft.ReportingServices.WebServer.Global.Application_AuthenticateRequest(Object sender, EventArgs e)
--- End of inner exception stack trace ---
In the above logs, only the highlighted area points to my code. Although i dont know why this exception is coming as i have the dll in the bin folder, and the CodeBehind attribute in the logon.aspx field is correct. But i have no clue about the rest of the exceptions. I tried attaching the debugger with aspnet_wp process, but that doesnt help either. Please help me in this regard.
Thanks
Naveed
View 4 Replies
View Related
Apr 24, 2007
Hello Everyone,
I have written a custom task which writes the details of an error in the windows event log.
I use the on error event to invoke this task.
To simulate the error I try to convert a string into a number. I see that there are multiple as many as 6 messges with different error codes being logged into the windows event log.
They vary from something tangible like number conversion failed to obsure things like thread was being aborted.
Is this normal? to see multiple messages for one type of error.
Can I control this, so that only one message is sent into the windows event log.
(reason is that we have a monitoring software which may raise multiple admin alerts for the same issue).
Thanks for your help in advance.
regards,
Abhishek.
View 3 Replies
View Related
Aug 25, 2006
Hi,I have a connection string in my web.config - to which I then refer to in my code through all my controls, they're all databound to it.Anyway - how do I catch any errors - such as when I want to view the website on a train, if I'm working on it.I don't want it to crash and burn [the site, not the train] - if I dont have access to the sql server.How can I wrap it in a try block!?- How do i then deal with controls which refer to the connection string?One solution I thought of - is to programmatically set all the databinding - and not just with the GUI. As that way I can wrap everything in a try{}catch{} block.Any other - site-wide way of doing this?Thank you,R
View 2 Replies
View Related
Feb 14, 2008
Got a weekly problem when our ISeries DB goes down for maintenence i get ODBC connection errors when the SqlDataSource tries to connect. Is there a method I can use to catch the exception? If so, what event from SqlDataSource can i use, and what approach should I take?Thanks in advance!
View 2 Replies
View Related
Jul 21, 2004
In SQL Profiler, I see Exception records with a TextData entry like:
Error: 2601, Severity: 14, State: 3
There is no other error text for that entry and there are no corresponding log entries. When I look up the help for error 2601, I see:
Message Text:
Cannot insert duplicate key row in object '%.*ls' with unique index '%.*ls'.
That's obviously a C sprintf format string. I would expect to see the resulting formatted text somewhere. Where would I find detail on these errors?
View 6 Replies
View Related
Nov 11, 2005
We are running a COM+ DLL that handles transactions and security with a SQL Server back-end. This project was started in VS 2003, but we just converted it to VS 2005. Since the conversion, creating a number of transactions in a row generates errors at consistent, but moving, locations in the code (i.e. the location where the failure occurs changes when I do things such as add additional try/catch statements, so it is not random but also clearly not associated with any particular line of code).
View 8 Replies
View Related
Dec 20, 2006
What is the "correct" way of dealing with exceptions in a data flow script component. i.e. am I supposed to catch all exceptions and then set some failure flag? The reason I ask is I've got a script in a dataflow which is occasionally throwing exceptions when trying to convert an empty string to a decimal. Problem was the package locked up and had to be terminated when the exception was thrown (and not caught in the script)?
The only thing which differentiates this package from others I've created is the data flow has a conditional split which creates 2 seperate paths loading 2 seperate SQL tables - the exception is being thrown in a script on one branch which seems to hand the entire flow
PS I have fixed the script so this doesn't happen, i.e. test if the input string is String.Empty and if so set the _IsNull property.
View 7 Replies
View Related
Jan 19, 2008
I am using .NET v2.0 and SqlServer2005 SB in 90 compatibility mode.
From my brief experience it appears that if I try to subscribe to SB with incorrect SQL or wrong names .NET will immediately throw an exception. However, if my code is correct but there is an error on the server (for example incorrect options as per http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=883992&SiteID=1) then SB will immediately fire the notification message but with €œerror€? instead of €œupdate€? content. How do I detect this?
My code is based on the http://msdn2.microsoft.com/en-us/library/3ht3391b(vs.80).aspx example. (I had too much trouble with the SqlDependency class, including overflowing error logs. So unlike the post at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=903713&SiteID=1 I am NOT receiving an SqlNotificationEventArgs object. I wish I were getting one!) I€™ve included my Listen() method below.
The debug portion of this code gives me message body that looks like the following when everything is good. What should it look like, if for example my SET OPTIONS (first link above) were wrong?
messageBody: <qn:QueryNotification xmlns:qn="http://schemas.microsoft.com/SQL/Notifications/QueryNotification" id="129" type="change" source="data" info="update" database_id="23" sid="0xF4F50461FD43CA4191A1173B9350632A"><qn:Message>7fd415c7-2986-411d-abfd-615cbce0af28</qn:Message></qn:QueryNotification>
Thanks. Code follows:
private void Listen()
{
// infinite loop on this thread: keep listening even after
// receiving notification
while( true )
{
// connects to SqlServer queue and sleeps until a notification msg arrives
using( SqlConnection conn = new SqlConnection( _connect ) )
{
WriteMessage( "RequestNotification: Listen connection opened." );
using( SqlCommand cmd = conn.CreateCommand() )
{
int msgBodyId = InvalidSubscriptionId;
cmd.CommandText = waitFor;
cmd.CommandTimeout = 0; // _notificationTimeout + 100;
try
{
conn.Open();
// the thread is blocked until the waitfor event occurs.
SqlDataReader reader = cmd.ExecuteReader();
// the waitfor has triggered when we've reached here.
WriteMessage( "RequestNotification: Notification received." );
// there may be mulitple notifications waiting, but there seems only
// ever to be a single record to read, but we still use the while
// construct to ensure we get them all...
while( reader.Read() )
{
// the messageBody is actually XML with a GUID embedded as the msgId, eg:
// <qn:Message>82120744-f2bf-4c62-a17c-867cc6eb040e</qn:Message>
String messageBody = FixupMessageText( System.Text.ASCIIEncoding.ASCII.GetString( (byte[]) reader.GetValue( 13 ) ).ToString() );
msgBodyId = MessageBodyId( messageBody );
// doesn't work, sqlbinary...
// String messageBody = reader.GetSqlXml( 13 ).ToString();
#if __dbg
// used for debugging
// messageText = System.Text.ASCIIEncoding.ASCII.GetString( (byte[]) reader.GetValue( 13 ) ).ToString();
Byte status = reader.GetByte( 0 );
Byte priority = reader.GetByte( 1 );
Int64 queuingOrder = reader.GetInt64( 2 );
Guid conversationGroupId = reader.GetGuid( 3 );
Guid conversationHandle = reader.GetGuid( 4 );
Int64 messageSeqNo = reader.GetInt64( 5 );
String serviceName = reader.GetString( 6 );
Int32 serviceId = reader.GetInt32( 7 );
String serviceContractName = reader.GetString( 8 );
Int32 serviceContractId = reader.GetInt32( 9 );
String messageTypeName = reader.GetString( 10 );
Int32 messageTypeId = reader.GetInt32( 11 );
String validation = reader.GetString( 12 );
StringBuilder sb = new StringBuilder( "MESSAGE", 1024 );
sb.AppendLine();
sb.Append( " " );
sb.Append( BuildMessage( "status", status ) );
sb.Append( BuildMessage( "priority", priority ) );
sb.Append( BuildMessage( "queuingOrder", queuingOrder ) );
sb.Append( BuildMessage( "conversationGroupId", status ) );
sb.Append( BuildMessage( "conversationHandle", conversationHandle ) );
sb.Append( BuildMessage( "messageSeqNo", messageSeqNo ) );
sb.Append( BuildMessage( "serviceName", serviceName ) );
sb.Append( BuildMessage( "serviceId", serviceId ) );
sb.Append( BuildMessage( "serviceContractName", serviceContractName ) );
sb.Append( BuildMessage( "serviceContractId", serviceContractId ) );
sb.Append( BuildMessage( "messageTypeName", messageTypeName ) );
sb.Append( BuildMessage( "messageTypeId", messageTypeId ) );
sb.Append( BuildMessage( "validation", validation ) );
sb.AppendLine();
sb.Append( " " );
sb.Append( BuildMessage( "messageBody", messageBody ) );
WriteMessage( sb.ToString() );
#endif
}
reader.Close();
// and now we need to hand things back to the user's passed delegate.
// orphan notifications can be left behind from previous runs,
// determine if this notification is one we want to pass on
if( _subscriptionId == msgBodyId )
{
WriteMessage( "Message " + msgBodyId.ToString() + " calling delegate." );
// see http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlnotificationinfo.aspx
SqlNotificationEventArgs e = new SqlNotificationEventArgs( SqlNotificationType.Change, SqlNotificationInfo.AlreadyChanged, SqlNotificationSource.Database );
_delegate( this, e );
}
else
{
WriteMessage( "Message " + msgBodyId.ToString() + " ignored." );
}
}
catch( SqlException )
{
// if the queue name doesn't match one in the db an exception will be thrown
throw;
}
finally
{
conn.Close();
}
}
}
WriteMessage( "RequestNotification: Listen connection closed." );
}
}
View 7 Replies
View Related
Dec 10, 2006
I've been successful at installing a customized SQLexpress using setup.exe /settings template.ini.
What I'd like to do now is see if I can progammatically detect a Firewall on the SQLexpress machine and if there is one to add the exceptions for sqlservr and sqlbrowser programmatically so that the user doesn't have to do anything.
Is this possible and how would I do it?
Thanks,
jerry
View 3 Replies
View Related
Jul 4, 2007
I use the following function (in the BLL) to delete some records:
Public Function DeleteStep4Dashboards() As Boolean
Try
adpDashboards.DeleteStep4Dashboards()Catch ex As Exception
Return False
End Try
Return True
End Function
How can I catch the sql database errors when deleting the records goes wrong.
View 5 Replies
View Related
Aug 6, 2007
Hello guys,I need some ideas on how to handle an exception or a user defined error message.I have a procedure that creates a new user. Lets say if the e-mail address entered is already in use. What are some of the best practices for notifying the user that the e-mail address is already in use?This is what I was thinking....Solution #1--------------My proc will raise an error with a message id that is great than 50000, then my DAL will recognize this is a user defined error and spit back to the user instead of trapping it.Solution #2--------------The proc should have an output param ( @CreationStatus CHAR(1) ).If the @CreationStatus has a value for example "E", I will have lookup the value for "E" in my app and spit back that custom error message. I don't really like this option because it is too concrete.What are some of the ways you deal with this situation?Your suggestions are greatly appreciated.Thank you!
View 2 Replies
View Related
Mar 3, 2008
When I first looked at the query behind highlight exceptions, I assumed that PredictCaseLikelihood() was the basis for deciding which rows to flag, but a closer look at the sample data shows this not to be the case. For example, looking at the "Table Analysis Tools Sample" table in the DMAddins_SampleData workbook, ID 11147 is highlighted while ID 11378 is not. Training a cluster model via DMX on this same dataset shows these rows having PredictCaseLikelihood values of 0.165 and 0.158 respectively.
Does anyone have an idea what methodology is used to select the Outlier rows? And once those rows are selected, how are the suspect columns within that row chosen?
Appreciate any clues or directions.
View 1 Replies
View Related
Sep 20, 2006
I'm setting up a routine to do some reindexing. To get the info I need I'm trying to use the new function. The DB I think is causing the problem does pass DBCC CHECKDB. I'm not sure why I'm getting this but can not find anyone else that is getting this same error.
When I run this....
SELECT *
FROM sys.dm_db_index_physical_stats (NULL, NULL, NULL, NULL, 'detailed')
I get this....
Location: qxcntxt.cpp:954
Expression: !"No exceptions should be raised by this code"
SPID: 236
Process ID: 1060
Msg 0, Level 11, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
Msg 0, Level 20, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
If I run only for the DB I think is causing the problem I get this...
Msg 0, Level 11, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
Msg 0, Level 20, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
View 6 Replies
View Related
Jan 28, 2008
Does anyone know of a way to capture in C# SQL PRINT ERROR MESSAGES generated from stored procedures? Any help would be greatly appreciated.
View 6 Replies
View Related
Jan 11, 2008
I came across a frustrating bug last week. Basically, whenever I tried to execute almost any sql query with unnamed parameters (i.e. using "?" instead of "@param_name" in the SQL text), an exception would be thrown.
After trying lots and lots of things and navigating my way through the internals of System.Data.SqlServerCe.dll, I discovered that the method System.Data.SqlServerCe.SqlCeCommand.CreateParameterAccessor(...) has a bug.
The bug is that the private arrays "parameters" and "metadata" are ordered differently, yet at one point in CreateParameterAccessor(...) they are compared using the same index. Here are the two lines:
p = this.parameters[ i ];
and
MetaData info = metadata[ i ]
and then the column data types of "info" & "p" are incorrectly compared in a later method, ValidateDataConversion(...).
So take a step back... how are they ordered differently? From observation, I concluded the following:
The "parameters" array is ordered exactly in the order that the DbParameter's were added to the DbCommand object.
The "metadata" array is ordered according to the column order of the table in the database.
So what causes the exception? Well, CreateParameterAccessor(...) passes data types from two different columns (one type taken from parameters[ i ] and the other from metadata[ i ]) on to SqlCeType.ValidateDataConversion(...). And, of course, if they differ (e.g. one column is of type DateTime and the other is a SmallInt), an exception is thrown.
I've found two workarounds, and both seem to work well.
The first is to name the SqlCeParameters (e.g. "SELECT ... WHERE id=@id"). This causes the buggy branch of code to be completely bypassed.
The second is to add the SqlCeParameters in the exact same order as the columns exist in the table you are accessing. Note, I do *not* mean the order that you select the columns (e.g. "SELECT column1, column2, ..."). I mean the actual order of the columns in the database.
I've included my setup and a stack trace below to help if it can.
My setup is:
.Net CF 3.5
SqlServer CE 3.5
Visual Studio 2008
Deployed to Pocket PC 2003
Here is the stack trace (note the variables passed to ValidateDataConversion):
System.Data.SqlServerCe.dll!System.Data.SqlServerCe.SqlCeType.ValidateDataConversion(System.Data.SqlDbType expectedType = DateTime, System.Data.SqlDbType actualType = SmallInt) + 0x4a bytes
System.Data.SqlServerCe.dll!System.Data.SqlServerCe.SqlCeCommand.CreateParameterAccessor(System.Data.SqlServerCe.MetaData[] metadata = {System.Data.SqlServerCe.MetaData[34]}) + 0x89 bytes
System.Data.SqlServerCe.dll!System.Data.SqlServerCe.SqlCeCommand.CreateDataBindings() + 0x5e bytes
System.Data.SqlServerCe.dll!System.Data.SqlServerCe.SqlCeCommand.CompileQueryPlan() + 0x16f bytes
System.Data.SqlServerCe.dll!System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(System.Data.CommandBehavior behavior = Default, string method = "ExecuteNonQuery", System.Data.SqlServerCe.ResultSetOptions options = None) + 0xa7 bytes
System.Data.SqlServerCe.dll!System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQuery() + 0x7 bytes
View 1 Replies
View Related
Apr 3, 2007
I have views that cast the data into data types.
On 2005 when retrieving the views using a where clause i get errors. I have put together an example below that illustrates the error.
CREATE TABLE TestData ( Id VARCHAR(10), [Description] VARCHAR(20), [Type] INT)
CREATE TABLE TestTypeLookup( [Type] INT, [Description] VARCHAR(20))
GO
INSERT INTO TestTypeLookup VALUES (1, 'Type 1')
INSERT INTO TestTypeLookup VALUES (2, 'Type 2')
INSERT INTO TestData VALUES ('AA', 'Description for AA', 1)
INSERT INTO TestData VALUES ('10', 'Description for 10', 2)
INSERT INTO TestData VALUES ('20', 'Description for 20', 2)
GO
CREATE VIEW TestView AS
SELECT TOP 100 PERCENT CAST(Id AS INT) Id, [Description]
FROM TestData
WHERE [Type] = (SELECT TOP 1 [Type] FROM TestTypeLookup WHERE [Description] = 'Type 2')
ORDER BY CAST(Id AS INT)
GO
SELECT * FROM TestView WHERE Id = 10
GO
DROP VIEW TestView
DROP TABLE TestData
DROP TABLE TestTypeLookup
GO
View 11 Replies
View Related
Aug 13, 2003
Hi All,
Can anybody suggest me a website where I can find articles on Managing transactions with Sql server. Also a scenario where the transactions take place in a environment involving 2 different databases, Like the bank account and credit card transactions (specifically of 2 way kind)
Thanks
View 5 Replies
View Related
Apr 6, 2005
I have a web application with a shopping cart, how do I stop all the shopping cart transaction from going into the db log? Is this possible? These are are only transient data movements, and will never be need to to restore to, and they are cause log bloat. Or is there a better way to stop log bloat?
Thanks
View 2 Replies
View Related
Apr 17, 2000
Hi All,
How can we change connection properties in a DTS pkg with connection?
You can loop through the connection count but the connection ID is not static one.So can’t rely on that.
Is there another way of changing connection properties?
Thanks in Advance
Barath
View 4 Replies
View Related