ado.net

What is the lowest impact method for profiling SQL Server for a specific client?

My local friendly DBA does not like the idea of allowing profiling on the SQL servers (even non-production ones) due to the impact on performance they have. Ironically, I'm trying to reduce the need for a whole bunch of SQL queries, and would like to be able to check in a fairly non-invasive manner what queries are being sent over the w...

Exception with connection in ADO.NET

I am trying to learn ADO.NET to connect with SQL Server ... I install SQL Server with Visual Studio .... there is data base called "Northwind" as example with it ... I am trying to read this database , I wrote this code ... using System; using System.Data; using System.Data.SqlClient; namespace DataSetReaderFromSQL { class Prog...

Closing SqlConnection and SqlCommand c#

In my DAL I write queries like this: using(SQLConnection conn = "connection string here") { SQLCommand cmd = new ("sql query", conn); // execute it blah blah } Now it just occurred to me that I am not explicitly closing the SQLCommand object. Now I know the 'using' block will take care of the SQLConnection object, but will thi...

How does ADO.NET' s SqlCommand.CommandTimeout work?

Consider a stored procedure that updates some rows about in 60 seconds without using a transaction. We set ADO.NET's SqlCommand.Timeout to 30 seconds. SqlCommand.Timeout = 30; When that timeout occurs at 30 seconds, will the stored procedure continue to run in database server or not? How does the server communicate this to the client...

Save table data as a XML file

Bellow is my SQL syntax CREATE TABLE [dbo].[Security_Module_Info]( [Client_Company_ID] [smallint] NOT NULL, [Module_ID] [tinyint] NOT NULL, [Module_Name] [nvarchar](50) NULL, [Module_Description] [nvarchar](200) NULL, [Is_Active] [bit] NULL, [Active_Date] [smalldatetime] NULL, [Record_Status] [tinyNULL, [...

Catch an exception of an asynchronous called SQL-Server stored procedure

I call asynchrounously some stored procedures with BeginExecuteNonQuery and EndExecuteNonQuery (in C#). How can I catch the (defined) exceptions of these stored procedures in the C# program? Or does the try{}catch{} also works for asynchrounous calls? ...

How to specify multiple restriction values in DbConnection.GetSchema

MSDN documenation for DbConnection.GetDBSchema says - Returns schema information for the data source of this DbConnection using the specified string for the schema name and the specified string array for the restriction values. Regarding the restriction values The restrictionValues parameter can supply n depth of values, whi...

C# if statment help with droptdownlist.selectedvalue

so I am connecting a sql database. I have a asp.net page and when the user selects the dropdownlist for status and selects the value to Closed, Then clicks update ticket button, i need it to take update the Closed_date column in the table. my table has the column Closed_Date type datetime. I have a stored procedure that updates that c...

Incorrect syntax near '*'. ASP.NET app connecting to SQL using ADO.net

im trying to bind a a sql statement to a datagrid. having some trouble: <%@ Page Language="C#" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.SqlClient" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <script runat="server"> ...

How many DataReaders can be created on a single DataConnection in ADO.NET?

As far as I know, via MARS(Multiple Active Result Sets), we can create several Datareaders on a single DataConnection. Please refer to http://msdn.microsoft.com/en-us/library/yf1a7f4f.aspx. I am wondering how many DataReaders can be created maximumly? ...

my site show error

my site show this error you can also check online it visit only 4 to 5 pages then http://www.pakcarid.com/ System.Data.OleDb.OleDbException: System resource exceeded. Source Error: Line 267: OleDbDataAdapter dtt = new OleDbDataAdapter(tot); Line 268: DataSet dstt = new DataSet(); Line 269: dtt.Fill(ds...

godaddy sql executor with .net

Hello Guys, Most of you might have known already that godaddy does'nt have any plugins or components to directly connect to the database hosted on their servers to run a sql statement. Godaddy wants the developers to login into their sql management interface and run the queries, which is a time consuming process and more over I personal...

Have XML file need it to populatemultiple SQL Tables

I have a XML file that I need to populate multiple SQL tables, and I was wondering what the best way to do that is. I was thinking dataset, or xslt but I honestly not sure. Here is my generated XML (part of it) <?xml version="1.0" encoding="utf-8" standalone="yes" ?> - <!-- Created: 8/3/2010 12:09:15 PM --> - <Trip> - <TripDetail...

XDocument to dataSet, my nested nodes are getting treated as new tables?

When looping through elements it thinks the child node is a table, when it should just be a column. I have most of the code working well, until I the code gets to this part: (all of my code is at the bottom) new XElement("TBL_Magic_TripCountries", lstCountry.Items .Cast<ListItem>() ...

DataAdapter: Is it possible to fill a Collection-Type instead of a DataTable/DataSet?

Hello, this is more a theoretical question i asked myself. I remembered that BinarySearch of an ordered List(Collection in general) is faster than finding Rows with Datatable.Rows.Find or DataTable.FindByPK with a primary key value. Hence i fill a Datatable from Database in a shared constructor and immediately after that a List(of Int3...

Strongly typed datasets and schema changes

Hello, I have a project which uses strongly typed datasets. Let's assume I want to change the database schema of the database used by this application. I have a table named Country and I want to add a new column named "IsADemocracy" (that's an example) of the SQL Server datatype BIT. Now, how do I update the strongly typed dataset so ...

Memory leak with .NET SqlConnection and DataSet

I'm having a memory leak issue in a service program that runs SQL scripts and dumps the results out to files. After running queries that produce many result rows, the memory usage of the process goes up by 50+ MB each time and doesn't come down. Here is the code that opens the connection and retrieves the results: using (var conn = new...

In ADO.NET, is a DataTable or a DataReader better to serialize?

I have static data in a single table which I must serialize. I have often read that a DataReader is more performant, if you wish to have read-only data that you traverse only once. If you wish to serialize this information however, would a DataTable be better? ...

IEnumerable to string

Hi. I have a DataTable that returns IDs ,1 ,2 ,3 ,4 ,5 ,100 ,101 I want to convert this to single string value, i.e: ,1,2,3,4,5,100,101 How can i rewrite the following to get a single string var _values = _tbl.AsEnumerable().Select(x => x); ...

Microsoft-provided data provider classes, the good and the bad?

What are advantages and disadvantages of Microsoft-provided data provider classes in ADO.NET? are they fast? ...