ado.net

how to know Datatable is already subscribed ??

How to know that DataTable is already subscribed to OnRowChanged or OnColumnChanged events ? I am facing a issue with many notifications in my app ? so I wanted to put a check and want to subscribe table only once ?? ...

DataAdapter returns a empty rowset, but DataReader returns data.

Hi, I execute a query that calls a SP, that SP returns data... but when I call it with a DataAdapter I get no result data, if use a DataReader instead... then I get data. The database is SQL Server and the code is using OleDb for reasons I cannot change. These two calls returns diferent things: String commandText = "Declare @retur...

Can I tell if an ado.net DbCommand is a query or not (before executing it)

I am trying to write a Powershell script to run a general SQL command against a database. The idea is that Run-SQL "select ..." will run the SQL text against the currently open database. If the SQL statement is a query, it should return a DataTable. If it is a non-query (DDL or DML) it should return nothing ($null). In order to do this,...

Using Access 2003 VBA functions through JET

Hallo all. I need to run the 'replace([column], [new], [old])' in a query executing on n Access 2003 DB. I know of all the equivalent stuff i could use in SQL, and believe me I would love to, but i don't have this option now. I'm trying to do a query where all the alpha chars are stripped out of a column ie. '(111) 111-1111' simply bec...

How to escape the parameter symbol in ADO.NET

We're using ADO.NET with parameterized queries with SQL Server using the DBCommand object, so the parameter symbol is @, and things have been working fine. However we now have a query where @ is part of the hard coded data. By default ADO.NET thinks it IS a parameter and the whole thing goes pear shaped. Is there a way to escape the @...

ADO.NET Performance : Which Approach will faster and resonable?

Hi all, I want to select certain amount of data from one table. Based on those data, I want to check another two tables and insert into 2 tables. So I want to iterate the resulted data. Which way is better(faster) and reasonable using DataReader or DataTable? Thanks in advance RedsDevils ...

Using DataGridViewComboBoxColumn and DataGridViewComboBoxCell

Hi, In my application i have datagrid with simple type of cells - string, integer. I want to change one of the cell from string to be combobox. i try to populate the in each line different inomration, but did not see anything. It means that i see comboBox in each cell of the column but the comboBox is empty. enter code here DataGri...

Any help with Oracle exception with ADO.Net !

When I'm trying to execute the following sql block, I got the following Exception ORA-06550: line 1, column 6: PLS-00103: Encountered the symbol "" when expecting one of the following: begin case declare exit for goto if loop mod null pragma raise return select update while with <an identifier> <a double-quoted delimited-ident...

How do I import mysql source file via ADO.NET

I'm writing an app which should take a sql file generated from mysqldump and import it into a mysql database. Is there a way to do this from ADO.NET or do I need to use the mysql cli? ...

What does your company use for database access and mapping? Does this make you happy or sad?

I started out at a medium sized financial firm, and everything was done using a home brewed ORM. I've recently moved to a web shop and it's a mix of ADO.NET and linq to sql. I'm wondering what other people are using at their shops, and why? Are you happy about this, or do you wish you were using another approach? Do-it yourself usin...

Calling Oracle stored procedure from C#.net?

I just started reading about stored procedures. Can anyone please help me call a stored procedure in oracle from C# Thanks in advance ...

ADO.NET (ODP.NET) and same Connection pool for different clients connection

We have to implement a two tier architecture to distribute a cache from a central Oracle DB to a lot of clients (circa 200) into an Intranet. After some experimentations we have opted to use a direct connection from the client to the DB server. This decision has been taken to simplify the architecture and to reduce the overheads. Client...

How to add Array as a property in ADO .NET Entity Framework

Hi, I am using Custom data service provider for an application. I need to add following class as entity public class PhysicalAddress { public PhysicalAddress(); public string City { get; set; } public string Country { get; set; } public string CountryCode { get; set; } } class Parent { public PhysicalAddress[] Address { ge...

How to create more than one stored procedure using ExecuteNonQuery?

The situation is: I want to create two stored procedures: query1 = CREATE PROCEDURE MyProc1 AS SELECT * FROM TEST1; and query2 = CREATE PROCEDURE MyProc2 AS SELECT * FROM TEST2; I can do it using command.CommandText = query1; command.ExecuteNonQuery(); command.CommandTest = query2; command.ExecuteNonQuery(); Is it possible t...

Convert SqlCommand to T-SQL command

I have an SqlCommand with parameters. Due to some external requirement (see PS), I need one T-SQL string instead, i.e., I need ... @parameter ... replaced by ... the-value-of-@parameter-encoded-correctly ... (e.g. O'Brien --> 'O''Brien', 02 Mar 2010 --> '20100302', 3.5 --> 3.5). I know that I could home-brew such a solution quite easil...

How to download GridView data after data binding?

In the past, I have populated GridView's with 'manually created' data sources in the code behind, by doing this in the Page Load: DataTable myData = SomeMethod(); //Returns a DataTable myGrid.DataSource = myData; myGrid.DataBind(); and whenever I wanted to download the data to a CSV file, I'd just add the following to the button's Cli...

Is SqlConnection-exceptions cached? Im getting the same exception even though changes have been made in between.

Consider this code (Yes its ugly but it should also work): try { // Test the connection to a database that does not exist yet... using (SqlConnection c = new SqlConnection("Data Source=localhost;Initial Catalog=test;Integrated Security=True")) { c.Open(); } // Dispose calls Close() } catch { //... will fail w...

Cant change database

hi all write one project and encountered with one problem code: private SqlConnection scon; private SqlCommand scom; string defConnection = "Data Source=" + Environment.MachineName + @"\SQLEXPRESS;" + "Integrated security=true;" + "database=dbTrash"; string altConnection = "Data Source=" + E...

How to achieve fast database sync. with a read-only source?

Hi folkds, I've got a source database (Sybase), which is read-only and you can write to the database with a import file. The other side is my own database (MSSQL) which has no limitations. The main problem is that there are no timestamps on the first database and I don't have any access to change the source database. So is there a engi...

Timeout a query

Hi, I wanted to know if we can timeout a sql query. In the sense, that suppose I have a sql query whose output is useful only if gives the output in 10 minutes ,after which even if it outputs the results its of no use to me. What I want to do is that if the query takes more than 10 minutes to do the processing then it should just kind...