DataSource Controls :: Cannot Evaluate Expression Error After Converting VS 2003 Web Application To VS 2008?
Jul 8, 2010
I recently converted a web application of ours to VS 2008 so that we could upgrade to .net 3.51 framework.
I have been making some changes to the layout, to take advantage of ajax and minimize the amout of data needing to be loaded and the number of postbacks processed.
The problem I am having is when I try to save the data.
The page postback calls a local Sub which reads the form data into local variables and then passes these variables to our assembly.
The primary assembly has 70 parameters which are used to populate one of the tables in our database.
So I have 70 local variables just for this call plus a variable reference to the output of the assembly which contains a property for each of the columns in the associated database record.
There are some additional assemblies called to update other tables so, in all there are 121 locally defined variables in this sub.
Bear in mind that this sub is called from the page load event which has 93 of it's own locally declared variables.
Here is what is happening, when I run the code I am using cdate() to convert the value of a text box to datetime and pass it to my assembly. When doing so it throws a conversion error.
So I created a local datetime variable and converted the value of the control to the datetime and passed the variable to the assembly.
No more error, but the proc did not save the data as it was supposed to.
What I noticed in debugging, on the locals tab, is that every local datetime variable displayed the following message:
Cannot evaluate expression because we are stopped in a place where garbage collection is impossible, possibly because the code of the current method may be optimized
I also noticed that on the watch window the same message would display if I attempted to reference any of the datetime controls on the form.
There are only 3 variables and 3 datetime controls that appear to be affected. the controls are all html input boxes. Every other variable and control on the form behaves normally and I can see their values while debugging, it is just these six that are exhibiting the problem, whats more is that they are not new controls to the form.
The code was executing fine but now an exception is generated: "exc = {Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.}"
In my application when i debug in catch block this error is showing,given below
"[System.Threading.ThreadAbortException] = {Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.}"
As soon as compiler execute this statement i get error
" [System.Threading.ThreadAbortException] = {Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.} "
What will be the possible reasons for the error.
Although it throws execption but it will allow to convert report when i deployed my site using http but when i deployed my site using https then it will shows error .
I am developing a C# VS 2008 / SQL Server 2005 Express website application. I have tried some of the fixes for this problem but my call stack differs from others. And these fixes did not fix my problem. What steps can I take to troubleshoot this?
System.Data.SqlClient.SqlException was caught Message="Conversion failed when converting datetime from character string." Source=".Net SqlClient Data Provider" ErrorCode=-2146232060 LineNumber=10 Number=241 Procedure="AppendDataCT" Server="\\.\pipe\772EF469-84F1-43\tsql\query" State=1 StackTrace: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at ADONET_namespace.ADONET_methods.AppendDataCT(DataTable dt, Dictionary`2 dic) in c:Documents and SettingsAdminMy DocumentsVisual Studio 2008WebSitesJerryApp_CodeADONET methods.cs:line 102 And here is the related code. When I debugged this code, "dic" only looped through the 3 column names, but did not look into row values which are stored in "dt", the Data Table. public static string AppendDataCT(DataTable dt, Dictionary<string, string> dic) { if (dic.Count != 3) throw new ArgumentOutOfRangeException("dic can only have 3 parameters"); string connString = ConfigurationManager.ConnectionStrings["AW3_string"].ConnectionString; string errorMsg; try { using (SqlConnection conn2 = new SqlConnection(connString)) { using (SqlCommand cmd = conn2.CreateCommand()) { cmd.CommandText = "dbo.AppendDataCT"; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = conn2; foreach (string s in dic.Keys) { SqlParameter p = cmd.Parameters.AddWithValue(s, dic[s]); p.SqlDbType = SqlDbType.VarChar; } conn2.Open(); cmd.ExecuteNonQuery(); conn2.Close(); errorMsg = "The Person.ContactType table was successfully updated!"; } } }
I am trying to insert a value in database from a dropdownlistddlvaue = 10.00 - 11.00in db asstarttime=10:00:00endtime=11:00:00using split function
string dropdownvalue = ddlduration.SelectedItem.Text.ToString(); string et = dropdownvalue.Split('-')[1].ToString(); endtime = et.Split(' ')[1].ToString(); starttime = dropdownvalue.Split(' ')[0].ToString(); I am joining date value + time value in the query uisng('" + datevalue + "' + ' ' + '" + starttime + "')
'2014-05-15' + '16.00' --> to get 2014-05-15 16:00:00
it is getting inserted successfullybut while selecting and viewing it from the database I am getting error as,
"Arithmetic overflow error converting expression to data type datetime"
If i mannually enter the date in db it is workingmanuall value=2014-09-30 14:00query value =2014-09-30 14:00
both are same but error is only occuring for query inserted value
We currently have a DB in SQL 2005 and would like to convert it to SQL 2008 taking advantage of all the new features (if there are any) in SQL 2008. Would like to know the best approach or if there are any tools which can convert all the tables/views/storeprocs etc to 2008 specifications...
"Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack." have redirected to a new page in repeater's itemcommand event. Error coming at line :
when I do so it simply concats the thing like value of rblxx.SelectedIndex "0" and 1 makes 01 and not 1.suggest some function and trick to add the numeric values not concat. I tried using System.Convert.ToInt32 but not worked for me.
i am getting this error: Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.and this is my code where i am getting error.
I am running a web application in vs-2008 on windows 2003 server.While execution of .net application, I am getting an error as"Unable to start debugging on the web server. Unable to connect to the web server. Verify that web server is running and that incoming HTTP requests are not blocked by firewall."
I have converted my web application developed using visual studio 2003 to 2008. Now my problem is that when I add a new control lets text box or dropdown list on the page or form that was developed in visual studio 2003, the control is not being recognised. How can I ensure that new controls are beiing recognised.
however, i am getting the exception, unable to evaluate expression because the code is optimized and usually, you fix it by adding a false to your response.redirect.
I understand that if you put a Response.Redirect inside a try-catch that you're going to get this error unless you specify the 2nd param of the redirect as false.But even looking at this article (PRB: ThreadAbortException Occurs If You Use Response.End, Response.Redirect, or Server.Transfer) I still don't understand why I have to set this to false for this particular line of code...we've always had true for that param until I wrapped that in a try-catc
I have a feedback page with rating controls and I use a stored procedure to insert the record using C#
I get an error when I try to insert about conversion.
[Code]....
I have 20 ratings and a textbox I think the error is with the last parameter @Overall
it displays on the page as 4.9 in a label control, it is previously calculated in the Calculate_Ratings(), and it is declared as a decimal, I have also tried it declared as double. My column is declared decimal(1,1) in sqlDatabase
The Error says
System.Data.SqlClient.SqlException: Error converting data type numeric to decimal. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException
when i am trying to uedit my recods in gridview this error is coming. I am using SQLDatasource with gridview and for edit purpose i am using stored procedure. I have manually executed the SP and its woring fine. my SP is here
When a sql query returns NULL , I can use the following code to evaluate:
[Code]....
When a sql query returns nothing, neither IsDBNull nor is Nothing works. I don't know why some sql queries return null while some return nothing when there are no data returned. But anyway, can somebody tell me how to evaluate nothing value returned in sql datareader in vb.net? When I put the cursor over signInfo variable in debug mode, I can see Nothing show as its value. But the line does not work
I am getting the error -- Error 1723. There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor. Action WEBCA_FillComboBox, entry: FillComboBox, library: C:DOCUME~1ADMINI~1.XYZLOCALS~1TempMSI15B.tmp -- when I try to deploy a ASP.NET application on the server.I am using "Enablehostheaders.js" to select the website where I need to install the files..I am using visual studio.net 2003/framework 1.1
I am trying to edit and update the following table. When i click update i recieve an error.
[Code]....
Error:
Server Error in '/LMS' Application.No value given for one or more required parameters.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OleDb.OleDbException: No value given for one or more required parameters.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
we are using transactional replication on an sql 2008 server. we try now to add a table to the replication that only consists of 1 culomn of type date and we insert the dates to the table. when we then create the replication we are getting an error on the creation of the snapshot. here is the create table with the insert dates:
USE [Product] GO /****** Object: Table [TimeSlices].[BaseDate] Script Date: 05/03/2010 15:52:24 ******/ IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[TimeSlices].[BaseDate]') AND type in (N'U')) DROP TABLE [TimeSlices].[BaseDate] GO USE [Product] GO /****** Object: Table [TimeSlices].[BaseDate] Script Date: 05/03/2010 15:52:24 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [TimeSlices].[BaseDate]( [TargetDate] [date] NOT NULL, CONSTRAINT [PK_BaseDate] PRIMARY KEY CLUSTERED ( [TargetDate] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO INSERT INTO [TimeSlices].[BaseDate] SELECT TargetDate FROM [TimeSlices].UDF_GetTravelDateRange(GETDATE()-2 , GETDATE()+1000) attached is the UDF: [Code].... this is the add article: use [Product] exec sp_addarticle @publication = N'Product$(QuoteNumber)', @article = N'BaseDate', @source_owner = N'TimeSlices', @source_object = N'BaseDate', @type = N'logbased', @description = null, @creation_script = null, @pre_creation_cmd = N'drop', @schema_option = 0x000000000803509F, @identityrangemanagementoption = N'manual', @destination_table = N'BaseDate', @destination_owner = N'TimeSlices', @vertical_partition = N'false', @ins_cmd = N'CALL sp_MSins_TimeSlicesBaseDate', @del_cmd = N'CALL sp_MSdel_TimeSlicesBaseDate', @upd_cmd = N'SCALL sp_MSupd_TimeSlicesBaseDate' GO
this is the error we get:
Message: Query for data failed
Stack: at Microsoft.SqlServer.Replication.Snapshot.SqlServer.NativeBcpOutProvider.ThrowNativeBcpOutException(CConnection* pNativeConnectionWrapper) at Microsoft.SqlServer.Replication.Snapshot.SqlServer.NativeBcpOutProvider.BcpOut(String strBcpObjectName, String strBcpObjectOwner, String strBaseBcpObjectName, Boolean fUnicodeConversion, String strDataFile, String strLoadOrderingHint, String strWhereClause, Boolean useTableLockHint, Int32 bcpFileFormatVersion) at Microsoft.SqlServer.Replication.Snapshot.SqlServer.BcpOutThreadProvider.DoWork(WorkItem workItem) at Microsoft.SqlServer.Replication.WorkerThread.NonExceptionBasedAgentThreadProc() at Microsoft.SqlServer.Replication.AgentCore.BaseAgentThread.AgentThreadProcWrapper() (Source: MSSQLServer, Error number: 0) Message: Conversion failed when converting date and/or time from character string. Stack: (Source: MSSQLServer, Error number: 241)
why we are getting the conversion error on the snapshot creation?
i am trying to install SQL Server R2 on my windows 2003 server (I downloaded the x64 version) but on the installation directory, just before i click next, to get the error, the path is as follows: C:ProgramFiles(x86)Microsoft Sql Server im not too sure if thats the problem though, just guessing, since i dont know anyother problem, and its a new server. I also tried multiple server restarts and still got the same error.