ado.net

Select TOP 5 * from SomeTable, using Dataview.RowFilter ?

I need to select 5 most recent rows from cached Dataview object, is there any way to do that? I've tried but Indexer DataColumn is empty. : public static DataView getLatestFourActive() { DataTable productDataTable = getAll().ToTable(); DataColumn ExpressionColumn = new DataColumn("Indexer",typeof(System.Int32)); Expression...

c# ADO.Net editing BindingSource.Current before Updating not changing data

Hi, I have a form with for example two textboxes bound via BiningSource to my DataTable. Now everything works fine but if I try to change something manually in BindingSource.Current, the changes aren't saved in the database, for example: in buttonSave_Click(): ((DataRowView)myBindingSource.Current)["Description"] += "foo bar"; myBindi...

ADO.NET Entity Framework: Can I have multiple entity types for the same row.

Hi all, I have a base class Participants inherited by Artist, Author and TextWriter. I have only one table in the data store: Participants { ID, FirstName, LastName, IsArtist, IsAuthor, IsTextWriter, } The idea is to have a class for all the roles that a participant can have. I've managed to create the edmx file...

If we cannot retrieve output parameters until SqlDataReader is closed, then why...?

1) While the SqlDataReader is being used, the associated SqlConnection is busy serving the SqlDataReader, and no other operations can be performed on the SqlConnection other than closing it. This is the case until the Close method of the SqlDataReader is called. For example, you cannot retrieve output parameters until after you call ...

Advantages of Sybase's AseClient for ADO.Net 2 over the ODBC driver

We have an ETL process that reads data from a Sybase DB via the ODBC "Adaptive Server Enterprise" driver v12.05 I'm wondering if there any any performance advantages specifically to migrating to the .Net 2 Sybase.AdoNet2.AseClient.dll ? ...

Generate Enum from Values present in a table using ADO.NET Entity framework

My requirement is to create an Enum based on values present in a table from DB. I am using ADO.NET Entity Framework model (.edmx file), Can any one of you help me out... Thanks, Vinni ...

DbDataReader with DbTransactions

Its the wrong way or lack of performance, using DbDataReader combinated with DbTransactions? An example of code: public DbDataReader ExecuteReader() { try { if (this._baseConnection.State == ConnectionState.Closed) this._baseConnection.Open(); if (this._baseCommand.Transaction ...

mark rows as deleted or updated befor loading them in a dataset

Hello, I'm developping a sync solution enables filtering but is there any way to load the changes form the source database into a dataset and mark the deleted or updated rows to transfer this dataset to client and update its data? thanks. ...

Shape-like query in T-SQL

I would like to write a T-SQL statement, that structures data to be loaded into a Ado.Net DataSet like it was possible with the ADO SHAPE command. Is there something similar in T-SQL? My idea is to select multiple rows from a main table and all related records from a child table. That data would get loaded in to a DataSet and then I wou...

How does the dataset designer determine the return type of a scalar query?

I am attempting to add a scalar query to a dataset. The query is pretty straight forward, it's just adding up some decimal values in a few columns and returning them. I am 100% confident that only one row and one column is returned, and that it is of decimal type (SQL money type). The problem is that for some reason, the generated met...

Defining DateDiff for a calculated column in a datatable

I have the column DateTimeExpired, and I would like to create another column called "Expired" which will show "Yes" or "No" according to the expiration date - "Yes" if the date has already passed. I wrote this: DataColumn colExpirationDate = new DataColumn("DateTimeExpired", typeof(DateTime)); DataColumn colExpired = new DataColumn("Exp...

ADO Execute not reading a line of SQL code?

My code is below: var statement = "test_oracle.sql"; F = aqFile.OpenTextFile(statement, aqFile.faRead, aqFile.ctANSI); F.Cursor = 0; while(! F.IsEndOfFile()){ s = F.ReadLine(); oResult = Project.Variables.oConnection.Execute_(s); The first line that "s" reads is: set serverout on size 10000 An error is returned as "OR...

Linq to SQL :How to work with already existing Business objects(Handwritten)

I was trying to implement a LINQ 2 SQL implementation to one of my page to load the data to a datagrid.The below is the code using (NorthwindDataContext context = new NorthwindDataContext()) { var customers =from c in context.Customers select c; // Line 1 gridViewCustomers.DataSource = customers; gridViewCustomers.DataBind();...

What data access class structures minimize code redundancy in a multiple database, simple CRUD application?

Suppose one has a number of databases -- 20 or more. Many seperate "workflows" of homogenous ASP.NET WebForms are used to provide a way for users to either insert or retrieve records from the databases. The forms are linked by a central user base and permissions model (which is not necessarily a factor in this question.) Very little "...

why DataColumn AllowDbNull is true even if oracle db does not allow null

Hi. I have column SomeId in table SomeLink. When I look with tOra or Sql Plus Worksheet both state: tOra: Column name Data type Default Null Comment SOMEID INTEGER {null} NOT NULL {null} Sql Plus: SOMEID NOT NULL NUMBER(38) I have authored a method that's intended to give default values to all...

C# Gridview - Checking if a column already exists when adding a new column fails

I have a GridView with 10 columns. On a certain condition, I want to add a new column called "Expiration Date". The problem is that when the user presses "Search" again (Postback) the column is added again. I check before adding the column, to see if it already exists: BoundField dtExp = new BoundField {DataF...

Convert byte array from Oracle RAW to System.Guid?

My app interacts with both Oracle and SQL Server databases using a custom data access layer written in ADO.NET using DataReaders. Right now I'm having a problem with the conversion between GUIDs (which we use for primary keys) and the Oracle RAW datatype. Inserts into oracle are fine (I just use the ToByteArray() method on System.Guid)...

unmanaged c++ and ADO.NET

I have to rewrite/extend(with features like connection pooling) portions of the database interace code in a multithreaded, enterprise scale legacy c++ applications. The application interacts with both SQL and ORACLE datbases. I was wondring if ADO.NET can be used instead of the current OLEDB / OCI solution. I am hoping to get some feedba...

Is there any Sql Query builder library for .Net?

Something like this. http://code.google.com/p/squiggle-sql/wiki/Tutorial. This is required for cases where It is required to build complex sql from the user input from UI. Currently in the project I am working is using String Manipulation which looks ugly and is difficult to maintain. ...

linq, selecting columns as IEnumerable<DataRow>

how can i do in linq: IEnumerable<DataRow> query = from rec in dt.AsEnumerable() where rec.Field<decimal>("column2") == 1 && foo(rec.Field<decimal>("column1")) select new { column1 = rec.Field<decimal>("column1"), column2 = rec.Field<decimal>("column2"), column3 = rec.Field<d...