.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
abhays
satyapriyanayak
SP
Ashutosh Jha
Mahesh
Post New Web Links

The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception.

Posted By:      Posted Date: September 03, 2010    Points: 0   Category :ASP.Net
 
 Hi all,When i run my project on my own computer, it works fine. But when i deploy it to server, it gives me this error. I can run my other dts and sp, but i get this error on this.. The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception. I googled it but could not find a solution. How can i solve this problem? 


View Complete Post


More Related Resource Links

the type initializer for 'system.runtime.remoting.identity' threw an exception.

  
HI, I am trying to implement kerberos delegation in Active Directory enviroment with windows 2003 servers SP2. I have Client, ProxyServer and RemoteServer application that are developed on .Net framework v3.5 using .Net Remoting "System.Runtime.Remoting". I am not using Microsoft.Samples.Security.SSPI &  Microsoft.Samples.Runtime.Remoting.Security directly. my code is based on "http://blogs.msdn.com/dotnetremoting/archive/2006/07/06/662599.aspx" Only change that I have done is put impersonate="true" in channel configuration of ProxyServer and RemoteServer, and of course changed the UPN and Port and IP address. The Client's credentials are successfully impersonated by ProxyServer, I can access the text file on ProxyServer on behalf of client. But when from ProxyServer I try to execute the method on RemoteServer it throws "the type initializer for 'system.runtime.remoting.identity' threw an exception." After looking at blog http://www.secnewsgroups.net/group/microsoft.public.dotnet.security/topic8251.aspx I did required changing under Local Security Settings -> Local Policies -> User Rights Assignments -> impersonate a client after authentication and Create Global Objects. I have added three domain user names in three machine under whose credentials corrosponding application is running. When i run three applications on their

User Control Web Part - The type initializer for 'IBM.Data.DB2.DB2Connection' threw an exception.

  

Hello,

I need help, in our SharePoint 2007 project we have created Web Part using VS 2005 & .Net 2.0, User Control. In the user control for one of the drop down list box databinding method we are using data from IBM DB2. It works fine on our local machine, but after Web Part deployment if i open the page then the Drop Down List is empty. I checked the log in the event viewer. I found the following error message in the vent viewer -

The type initializer for 'IBM.Data.DB2.DB2Connection' threw an exception.

 

Detail Error Message -

An unhandled exception occurred and the process was terminated.

Application ID: /LM/W3SVC/2076212728/Root

Process ID: 26880

Exception: System.TypeInitializationException

Message: The type initializer for 'IBM.Data.DB2.DB2Connection' threw an exception.

StackTrace: at IBM.Data.DB2.DB2Connection.Finalize()

InnerException: System.InvalidOperationException

Message: SQL1159 Initialization error with DB2 .NET Data Provider, reason code 7, tokens 9.1.1.DEF.2, SOFTWARE\IBM\DB2\InstalledCopies

StackTrace: at IBM.Data.DB2.y.f.a()

at IBM.Data.DB2.DB2ConnPool.g()

at IBM.Data.DB2.DB2ConnPool..ctor()

at IBM.Data.DB2.DB2Connection..cctor()

For more information, see Help and Support Center at h

Error 1259 The type initializer for 'System.Web.Compilation.CompilationLock' threw an exception.

  

In my asp.net application i  have getting an error

Error 1259 The type initializer for 'System.Web.Compilation.CompilationLock' threw an exception.  
 How to solve this one

I configured this application in iis.

As per the many forum result . i changed the framworkwortion in asp.net  tab of iis proprty.

So kindly give a good solution for it

<%

 

@ Page AutoEventWireup="false" CodeFile="IDNotification.aspx.vb" Inherits="IDNotification" Language

An exception of type 'System.Data.SqlClient.SqlException' occurred and was caught

  

When the Stored procedure is executed through SQL Server Management Studio, its taking 23 seconds

When the same Stored proc is called through web app, its throwing below copied exception. It is noticed that when the data is more than 100k records this exception is thrown other wise expected records are shown in UI. Another stored proc from the same app returns over 150k records without any excetpion.

Can't conclude that the exception is in Stored proc, because it works from SQL Server Management studio, but throws below exception from Web app.

Your help is appreciated in resolving this issue.

An exception of type 'System.Data.SqlClient.SqlException' occurred and was caught.
----------------------------------------------------------------------------------
10/17/2010 16:56:01
Type : System.Data.SqlClient.SqlException, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Message : Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
Source : .Net SqlClient Data Provider
Help link : 
Errors : System.Data.SqlClient.SqlErrorCollection
Class : 11
LineNumber : 0
Number : -2
Procedure : 
Server : XXXXX
State : 0
ErrorCode : -2146232060
Data : System.Collection

Exception : The type initializer for 'System.Text.BaseCodePageEncoding' threw an exception

  

Hi,

I'm getting a strange exception in the following situation:

Dotnet application written in C#.

Pinvoking a dll written in C++ in which I'm calling CoInitialise();

After calling functions inside the dll, a call to System.console.WriteLine or a call to SQLConnection.Open() throws the following exception.

If I start the program with System.console.WriteLine("Starting Application) , then it solves the problem, as if it had initialized the environnement correctly before pinvoking the dll.

 

Do you have a explanation of this strange behavior?

 

 

   at System.Text.BaseCodePageEncoding.FindCodePage(Int32 codePage)
   at System.Text.BaseCodePageEncoding.LoadCodePageTables()
   at System.Text.BaseCodePageEncoding..ctor(Int32 codepage, Int32 dataCodePage)
   at System.Text.Encoding.GetEncoding(Int32 codepage)
   at System.Data.SqlClient.TdsParser.ProcessEnvChange(Int32 tokenLength, TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlInternal

System.Security.SecurityException: Request for the permission of type 'System.Data.SqlClient.SqlCli

  
I have created a windows library control that accesses a local sql database I tried the following strings for connecting Dim connectionString As String = "Data Source=localhost\SQLEXPRESS;Initial Catalog=TimeSheet;Trusted_Connection = true" Dim connectionString As String = "Data Source=localhost\SQLEXPRESS;Initial Catalog=TimeSheet;Integrated Security=SSPI"   I am not running the webpage in a virtual directory but in C:\Inetpub\wwwroot\usercontrol and I have a simple index.html that tries to read from an sql db but throws the error 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.   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, etc etc  The action that failed was:DemandThe type of the first permission that failed was:System.Data.SqlClient.SqlClientPermissionThe Zone of the assembly that fa

'schema.AllCategories' threw an exception of type 'System.UnauthorizedAccessException

  
We're porting a solution from 2007 to 2010 and we're having trouble accessing the CrawledProperties property from the Schema object. Other properties from the Schema object however are accessible (e.g. AllManagedProperties). It does not matter whether we use the obsolete SearchContext to create the Schema object, or the new SearchServiceApplication (Example code from Steve Curran here: http://social.technet.microsoft.com/Forums/en-US/sharepoint2010programming/thread/2550e6e8-34a6-4012-969f-9657dc526d74) Now what's interesting is that the SAME user (Farm administrator) can access the AllCategories using a Windows Forms application, but when using a SharePoint solution (Codebehind on an application page) it doesn't work. We have double-checked that the executing user is the same. The same user can also browse the CrawledProperties using the Central Admin UI. We're experiencing this on several server installations, one of which is the "Standalone" installation of Search Server Express 2010, whereas the same user was used to perform the installation. I'd appreciate any ideas you might have.

In Reporting Services: Request for the permission of type 'System.Data.SqlClient.SqlClientPermissio

  
Hello all,In Reporting Services through http://myserver/mydbinstance/Pages/Report.aspx blah de blah blah, I get this error:Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.Actually, the report runs just fine, but some fields had the famous #Error in them. I put some old fashioned debug in my report to TRY, CATCH, END TRY and get the problem to the report so that I could see this report finally run in production. Yes, it runs just fine in VS2005. I have custom code in the report code window that does its own custom connection to an SQL database through "System.Data.SqlClient.SqlConnection" and "System.Data.SqlClient.SqlCommand" to pull in data that is not part of any of the datasources in the report. When I execute the report through the Report Manager or Report site under IIS, the report will run, but I get these errors in every field that uses functions to populate the data.I have searched the web for 3 days now, and the best answers involve using either CASPOL or the Microsoft .NET Framework 2.0 Configuration wizard in Administrative Tools on the server. (I understand that the wizard does the same thing as CASPOL, just through a GUI.) I have followed those steps, but still get the error.I do not know what I need to do to make these DLLs th

System.Data.SqlClient.SqlConnection'

  

Hello

Please look at the error given below

'System.Data.SqlClient.SqlConnection' does not contain a definition for 'Fill' and no extension method 'Fill' accepting a first argument of type 'System.Data.SqlClient.SqlConnection' could be found (are you missing a using directive or an assembly reference?)


Code which directing me error

using System;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;
using System.ComponentModel;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;

public partial class Display_Image_IO : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        GridView1.DataSource = fetchImages();
        GridView1.DataBind();
    }

    public DataTable fetchImages()
    {
        SqlConnection da = new SqlConnection(GetConnectionSt

Unable to cast object of type 'System.Data.SqlClient.SqlCommand' to type 'System.IConvertible'.

  

using

System;

using

System.Collections;

using

System.Configuration;

using

System.Data;

using

System.Linq;

using

System.Web;

using

System.Web.Security;

using

System.Web.UI;

ServerVersion = 'Conn.ServerVersion' threw an exception of type 'System.InvalidOperationException

  

Hi

I have a web service  which tries to connect to the SQL server.

It uses Integrated security = true.

I get the Conn.ServerVersion threw an exception of  type System.InvalidOperationException as soon as the connection object is instatiated.

Any leads.

Thanks.


The type initializer for 'Nested' threw an exception for BDC USING Application Definition Designer

  

Hi,

Is anyone know what this error could mean?

The type initializer for 'Nested' threw an exception.

when i am executing instance method using "Application Definition Designer" for BDC.

Same ADF file works fine locally but getting above error message when executing on server.(both sharepoint are different) and install on different machines.

When executing BDC catalog file in sharepoint. We are getting below error message.

An error occurred while retrieving data from CustomerBDC_Instance. Administrators, see the server log for more information.

Event log:

<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">

- <System>

<Provider Name="Office SharePoint Server" />

<EventID Qualifiers="0">5703</EventID>

<Level>2</Level>

<Task>1330</Task>

<Keywords>0x80000000000000</Keywords>

<TimeCreated SystemTime="2010-10-22T12:20:39.000Z" />

<EventRecordID>42186</EventRecordID>

<Channel>Application</Channel>

<Computer>[LOCAL COMPUTER ADDRESS]</Computer>

<Security />

</System>

- &l

System.Data.SqlClient.SqlException: Error converting data type nvarchar to datetime.

  

 Hi All,

I have recently moved a ASP.NET webserver from windows XP to
windows server 2008.
The website runs fine apart from anywhere that pulls a date
or uses the date from a JS date picker etc.

The error I am receiving is:

System.Data.SqlClient.SqlException: Error converting data type nvarchar to datetime.

Source Error:


Line 79:         cmd1.Parameters.AddWithValue("@EndDate", lblSearch2.Text);
Line 80:         conn.Open();
Line 81:         SqlDataReader reader = cmd1.ExecuteReader();
Line 82:         if (reader.HasRows)
Line 83:         {
 

Source File: c:\inetpub\wwwroot\folderx\pagex.aspx.cs    Line: 81

Stack Trace:


[SqlException (0x80131904): Error converting data type nvarchar to datetime.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1951450
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4849003
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject s

Unhandled Exception in System.Data.SqlClient.SqlCommand.ExecuteNonQuery()

  

Hi,

I have a windows service app which has been running for days now perfectly well, but last night it stopped.

The service app is built using .Net 4 Framework Client Profile with a dll built with .Net 4 Framework (why the difference I can't be sure now !!).

The app is running on Windows 2008 Server and connects to a local SqlExpress 2008 R2.

My call to System.Data.SqlClient.SqlCommand.ExecuteNonQuery() is wrapped in a try/catch but did NOT get caught !! :

The C# function being called (within my dll from a wrapper function) is :

 

 

private

Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend