ado.net

Is there a SqlFileStream like class that works with Sql Server 2005?

For the background to this question, see “How to I serialize a large graph of .NET object into a SQL Server BLOB without creating a large buffer?” that now has a large bounty on it. SqlFileStream gives you an IoStream that sits on top of a blob (varbinary) value that is stored in the database. However due to limitations ...

How To Remove Foreign Key Reference In Entity Framework

Hi, I'm updating my model which is built by entity framework. I removed a entity from the designer and then there pops up a error said "Foreign key constraint 'FK_Table1_Table2' ... no mapping specified for the table Table2. Now I really don't want to map Table2 into entities. What should I do to clear the edmx and avoid such error? Can...

How to Filter ADO.NET data using a Full Text Seach (FTS) field?

Hi All, We are using ADO.NET dataservices & are building URL based filters. Example: /Customers?filter=City eq 'London' We now need to filter on a Full Text 'tags' Field. WAS HOPING FOR: /Customers?filter=Tag like 'Friendly' PROBLEM: ADO.NET does not have a LIKE operator. ADO.NET does not seem to like FTS (It is not finding a match - b...

where to find MyGeneration.dOOdads.dll

how to get MyGeneration.dOOdads.dll Actually I produced code from Mygeneration utility and it requires this dll file. I find on many places but failed. ...

Can I use SQLParameter when having a variable quantity of fields to update?

Hello ADO.NET experts, I have a table with eighty fields, none to seventy of them can change depending of an update process I have. For example: if (process.result == 1) cmd.CommandText = "UPDATE T SET f1=1, f6='S'" ; else if (Process.result == 2) cmd.CommandText = string.Format("UPDATE T SET f1=2, f12={0},f70='{1}'", getData(...

ASP.NET MVC View Model with LINQ To Entities

Let's say I create a query result var query = from a in tblXYZ join c in tblABC on a.id = b.id select new {a.x, b.x}; What's the best way to pass that into a view? Should I create a new object and copy the query result into it? ...

winforms concurrency question

Hi, What approach(es) would you recommend regarding a WinForms application that will have both the user interface & a scheduling components regarding sharing configuration data from the database? (exposed in the program via DataTable) Assume both the scheduled task and the user interface can make updates to the shared data. Also ass...

IQueryable contains any of string array

I am not shore why IQuerable limits me when I try to search database for data containing string from an array. objectFactory.Resolve<IUserDao>().Query. Where(t => (spltedInput.Any(val=> t.LastName.Contains(val)) || spltedInput.Any(val=> t.Name.Contains(val))) && t.MasterCompany.I...

Exporting a Dataset to Excel (CSV) in a nested form.

I have a dataset consisting of 3 datatables - A,B,C. A.childID is related to B.ID, and B.childName is related to C.Name. Meaning: childName is a foreign key in B, and childID is a foreign key in A. I want to export this dataset to excel, with the dataset tables nested in each other: A.childID1 A.XXX A.YYY.... B.ID1 .... B.ID1 ...

Oracle & Pagination

I have a oracle table with record count of 99896618. I need to fetch small chunk of data(lets say 100 records) to show it on a web page,(In web world we call it paging). Currently I am using the following query to accomplish that however users are not satisfied with the performance. SELECT * FROM (select rownum rnum,f.* from findings ...

how to update row in DataGridView ?

hi i have DataGridView that fill with DataSet. how i can change any cell in DataGridView - and this change will change the DataSet too (and the Database). can i get any sample program for this (C#) ? thank's in advance ...

When does a db transaction written in ADO.NET actually begin?

One of the key things in database-intensive applications is to keep the transactions as short as possible. Today I was wondering when this transaction would actually begin: using (SqlConnection sqlConnection = new SqlConnection(connectionString)) { sqlConnection.Open(); /*(1)*/ SqlTransaction sqlTransaction = sqlConnection...

What's the best way to read a tab-delimited text file in C#

We have a text file with about 100,000 rows, about 50 columns per row, most of the data is pretty small (5 to 10 characters or numbers). This is a pretty simple task, but just wondering what the best way would be to import this data into a C# data structure (for example a DataTable)? ...

Best way to create unique identities for distributed data that will be merged?

I have a centrally hosted database (MS SQL Server) and distributed clients save data to it over the Internet. When the Internet connection goes down the client starts storing new data locally into a SQLite instance. When the Internet connection comes back online the accumulated local data is moved to the central db (inserted). What's th...

Is DataAdapter a reliable way to Insert data into an SQL Server Database

Yesterday My colleague told me that using data adapter to insert data into an sql server database is not reliable, because it does not guarantee that data are inserted properly. He also told me that if the data insertion is unsuccessful, it does not show any kind of error message. I am really confused. I thought microsoft invented ado.n...

Passing database name as variable to SQL from C#. Is it possible?

I've 2 tables having exactly same columns. But they are stored in Database1 and Database2 (on same server). Can i pass database name as variable? For example: SELECT [SomeValue] FROM [Database2].[dbo].[Klienci] SELECT [SomeValue] FROM ...

SQL Server connection pool doesn't detect closed connections?

For years, I've experienced very weird problems on all my web applications that connect to a SQL server. The problem is that if something happens to the database server (server restart or other problem), de web app stops working from that point on, even if the database server is alive and well afterwards. What happens is that every ADO...

Returning an open data reader from a WCF Service

Is it possible to return a data reader from a WCF Service api to a client which is running on a different machine. The serialization mechanism being used is NetDataContractSerializer. The data reader is being sent to the client to read chunks of binary data from the database. The data reader has a method GetBytes() which supports chunkin...

Why does adding a new value to list<> overwrite previous values in the list<>

Following a few tutorials and such I was able to successfully create a collection class which inherits the functionality needed to create a DataTable which can be passed to a Sql Server's stored procedure as a table value parameter. Everything seems to be working well; I can get all of the rows added and it looks beautiful. However, upon...

Will putting a using() around a datareader close it?

I usually write my datareader code like this: try { dr = cmd.ExecuteReader(CommandBehavior.SingleResult); while (dr.Read()) { //Do stuff } } finally { if (dr != null) { dr.Close(); } } Is it safe to replace the t...