sqlclient

Report Viewer - Request for the permission of type SqlClientPermission failed.

I am using the ReportViewer control from Visual Studio 2008 in Local Mode with objects as the data source. My classes are mapped to data tables in my database. In the objects, it loads related objects as needed. So it leaves the reference null until you try to use the property, then it tries to load it from the database automatically. Th...

Benefits of using sqlclient data provider with sql server 2005 over oledb data provider

hi all, Recently I think of shifting from oledb data provider to sqlclient as I am using sql server 2005 express edition as my app's backend which contain millions of records.. Can anybody give me concrete reasons for the same please reply sooon ...

how to create windows applications in VB.Net or ASP.Net

which method is more efficient to use: DataAdapter and DataSet Or DataReader when importing data from a certain database table??? ...

When should I be using Odbc, OleDb, SQLClient? What are the trade-offs

I am starting off with a SQLServer database. So it would seem that I should use System.Data.SqlClient namespace. But, there is a chance that we might shut down our SqlServer database and go to MySql or Oracle. For this reason, I am coming up with a set of standards on how our .Net apps will communicate with the database, so as to make it...

Multiple Asynchronous SqlClient Operations - Looking for a good example

I have been using Asynchronous operations in my WinForms client since the beginning, but only for some operations. When the ExecuteReader or the ExecuteNonQuery completes, the callback delegate fires and everything works just fine. I've basically got two issues: 1) What is the best structure for dealing with this in a real-life system...

DbParameter IsNullable functionality?

I have not worked with parameters in ADO.Net very much. I'm writing a custom .Net data provider (modeled on SqlClient), and have to implement the IsNullable property in my parameter class, which inherits from DbParameter. My data provider will not support stored procedures, so I will only be supporting Input (substitution style) parame...

Very slow connection to SQL Server 2005 only if using ADO.NET with SqlClient

I have a brand new server with Windows 2008 Server 64 bit + SQL Server 2005 Standard Edition SP3. When I try to open a connection to this server from a client in the same domain (Windows XP, .Net 3.5), it takes around 20 seconds to open the connection. After opening the connection, everything is fast as usual. When using a MDAC 2.8 co...

SqlClientPermission failure in assembly loaded via reflection

I am having a really tough time with a problem. I have a web application that I have just modified that allows customers to supply custom assemblies that they can use to hook into an entity save pipeline. These custom assemblies are loaded via reflection when an entity is persisted to the database. They refer to a common DAL assembly ...

Manually connecting to database in Asp.net MVC

Is it possible to manually connect to the database using sqlclient and sqlconnection (ie standard ADO.net way) instead of using LINQ or Entity Framework in Asp.Net MVC? Please guide me Thanks ...

How to DataSet.Fill with DateTime values defaulting to DateTimeKind.Utc?

I have an application which would read data from SQL and send it via WCF to a client app, in a manner similar to this: SqlDataAdapter da = new SqlDataAdapter( cmd ) DataSet ds = new DataSet(); da.Fill( ds ); return ds; All the date/times are stored in the database as UTC. What I noticed is that if clock on computer running the applica...

Linq to SQL: Ammend command before submission to database

Is there a hook somewhere within Linq to SQL that would allow me to manually modify a command before it is sent to the database? Specifically, I am trying to introduce the WITH CHANGE_TRACKING_CONTEXT(@contextData) syntax whenever an insert/update/delete is applied to the database in order to be able to add additional information agains...

C# Update Table using SqlCommand.Parameters

I'm trying to update an MSSQL table using SqlCommand, I think it's a syntax error with my T-SQL, but here is what I have so far: SqlCommand sqlCmd = new SqlCommand("UPDATE yak_tickets SET email = @emailParam, subject = @subjectParam, text = @textParam, statusid = @statusIDParam, ticketClass = @ticketClassParam WHERE id = @ticketIDParam"...

C# Update Table using SqlCommand.Parameters ASP.NET

Possible Duplicate: C# Update Table using SqlCommand.Parameters I'm trying to update an SQL Server table using SqlCommand, I think it's a syntax error with my T-SQL, but here is what I have so far: SqlCommand sqlCmd = new SqlCommand( "UPDATE yak_tickets SET email = @emailParam, subject = @subjectParam, text = @textParam...

ADO.NET SqlClient connection string - Data Source syntax

Is there any official write-up what forms can Data Source field take in sql server connection string? I'm aware of following forms: SERVER SERVER\Instance tcp:SERVER,port nb:SERVER nb:SERVER\Instance are there more forms? EDIT: The essence of this exercise is not to construct a connection string. I am trying to parse existing connect...

SqlClient Xml Output parameter "was not supplied"

I receive an SqlException when running the following code. "Procedure or function 'usp_Search' expects parameter '@pxmlSearchOutput', which was not supplied." My parameters + request. using (var connection = new SqlConnection(_connectionString)) { using (var command = new SqlCommand("Search.usp_Search", con)) {...

why would GetValues take an object array as input rather than return a new array

The SqlDataReader class offers a method called GetValues. What I find curious about this method is that it takes an object[] as input and returns an int of the number of values copied into the array. Any idea why the method was designed that way, rather than returning a new Array? ...

SqlCommand() ExecuteNonQuery() truncates command text.

I'm building a custom db deployment utility, I need to read text files containing sql scripts and execute them against the database. Pretty easy stuff, so far so good. However I've encountered a snag, the contents of the file are read successfully and entirely, but once passed into the SqlCommand and then executed with SqlCommand.Exec...

Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data

I created an assembly containing WCF service code and dropped into another web project. When I try to invoke a service method, I get the following inner exception: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. Why th...

"Cannot open user default database" error with "User Instance=True"

I have a desktop application that uses Sql user instancing. This is my connection string: "Data Source=.\SqlExpress; AttachDbFilename=C:\path\file.mdf; Integrated Security=True; User Instance=True; Connect Timeout=100;" My application creates this DB, downloads a load of data into it from a web service and then does a lot of actions w...

.Net Windows Service Throws EventType clr20r3 system.data.sqlclient.sql error

I have a .Net/c# 2.0 windows service. The entry point is wrapped in a try catch block that notifies me of problems and allows the service to continue operating normally yet when I look at the server's application event log I see a number of "EventType clr20r3" errors that are causing the service to die unexpectedly. The catch block has...