ado.net

Linq to SQL vs Entity Data Model: Getting a stored proc to run

Was I was previously messing with Silverlight and RIA, I was using a an ADO.NET Entity Data Model and domain context. I'm teaching myself how to run a stored procedure from RIA, and could not get it to work with the previous setup so I then started to try out using the LINQ to SQL method. I did the following: Added the DBML Drag and d...

DataGridView, databinding, and ComboBox filtering

Hello, I have a DataGridView with a combobox column in it, showing the possible prices, and I would like to only display the prices relevant to the particular row. In more details, let's say that I have a class method which returns me a dataset with 2 tables populated (feeded by a stored procedure running on a SQL Server 2005 database)...

retrieve Mysql server time using ADO.net

I am using ADO.net and LINQ-to-Entities in VS2010 to connect to Mysql server, and I would like to know what is the current date and time on the server side. Is there any method to do this using a LINQ query? I don't want to use any SQL statements in my program. ...

Hide ID column in ListView control

I'm binding ListView control to DataTable. The DataTable have a column named ProductID. Is there any way to hide this column, because I'm gonna need it's value later? ...

ADO.NET EF as DAL

Hi. I'm developing a project using a layered architecture. I have a DAL in which i'm using Entity Framework, a business logic layer which consumes the objects returned by the DAL and an app layer. I'm not entirely sure i'm thinking this right, so i'll just ask you what you think. My DAL is based on mappers. I have types - mappers - th...

What causes ArgumentOutOfRangeException on SqlConnection.Open()?

In trying to write a simple C# ADO.NET application to connect to my database and manage project entries for my website, I've run into a strange problem that I can not find any information regarding. I've verified that my MySQL server is accepting remote connections, listening on port 3306, the username provided is valid, as is the passwo...

Data Adpater vs SQLCommand

Hello all, I am confused about the SQL Data Adapter in ADO.Net. What is the difference between the below: SqlDataAdapter adapter = new SqlDataAdapter("Select * from Course", sqlconn); and SqlCommand Command = new SqlCommand("Select * from Course", sqlconn); Can someone please explain? Thanks ...

DAL classes generater using DAAB or ado.net ?

I am using enterprise library DAAB with 4 layers User interface layer, custom type layer, business logic layer, data access layer. I want to remain in 4 layers please guide is there any preferably free/ open source code generater that can generate my DAL classes. Or some way to generte DAL using simple ado.net ? thanks ...

How to save image in database using C#

I want to save user image into a database in C#. How do I do that? ...

C#.Net ASP.Net Data Controls

Using This code: I am tring to fill the page with the data and I would like to edit the data when it is displayed, but it says could not find table '0'. Dataset returns null value. Could any one help me pls. protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Fil...

how to print single value of data set

conn = new SqlConnection(@"Data Source=ASHISH-PC\SQLEXPRESS; initial catalog=bank; integrated security=true"); ada = new SqlDataAdapter("select total_amount from debit_account where account_no=12", conn); ds = new DataSet(); ada.Fill(ds); Now, I want to print value of the dataset... how? Please help me. ...

ADO.NET Entity Framework: Problem with updates on related objects

Hi experts, I’m playing around with a little VB.NET app with WPf/MVVM and ADO.NET EF on a SQL Express-DB and I’m running into problems while trying to update related objects: My DB has three tables “tb_Actors”, “tb_Movies” and a junction table “tb_movies_actors”. The EF designer creates two entities "Actors" und "Movies" and sets thei...

Inner TransactionScope with different IsolationLevel, how can it be achieved?

The current implementation of TransactionScope lacks the ability to change IsolationLevels in nested scopes. MSDN states: When using nested TransactionScope objects, all nested scopes must be configured to use exactly the same isolation level if they want to join the ambient transaction. If a nested TransactionScope object tries to joi...

Upload sequentially a huge file to a database using a pointer

Hi, It's a requirement in my app that the users can upload files to the database. At this point, the user upload the file and the webpage save it in a temp directory, secondly the logic load the file in a Byte[] and pass this array as parameter to the "insert" SQL statement. The problem with that approach, is that if the user try to up...

How do I set DataAdapter.UpdateBatchSize to a "optimal" value?

Hi there, I've finally gotten my insert batch to work and now I've been fiddling with the size of the batch, but I can't see any difference in performance between a value of 50 and a value of 10000. This seems very odd to me, but I don't know what's happening behind the scene, so it might be normal behavior. I'm inserting 160k rows int...

Fill DataTable from DataReader row by row

Hello, i want to fill a Datatable with a Datareader row by row but get an exception because the reader's columns have a different order than the Datatable's columns. Why and how does a Datatable loads itself with a Datareader correctly, even so it has a column collection with different order? I need to calculate values for every row s...

Acceptable Business Layer and Data Access Layer Pattern That Supports ADO.Net Transactions

I have a problem that is essentially what was briefly discussed in StackOverflow but I want to clarify the philosophy, pattern, and actual use of ADO.Net transactions. I have a .Net 2.0, VB.Net application that accesses a Sybase database using OleDB. I many cases that look something like this - starting in the DAL: Class PersonClass ...

XSD element in DataSets

I have an XSD file with various elements like <xs:element name="a1" type="xs:int" /> <xs:element name="b1" type="xs:string" /> <xs:element name="c1" type="xs:unsignedByte" /> etc. based on conditions in code i assign DataRow drXML = xmlDoc.DataSet.Tables["COLLECTION"].NewRow(); for ex: drXML["b1"] = dr.GetString("b1"); (this d...

Searching via DataTable.Select, BindingSource and foreach (C#, ADO.NET)

Hi, I have a DataTable X, if I now want to search for a certain entry, would it be faster/better to use BindingSource.Filter, X.Select() or just foreach? ...

.NET: How to insert XML document into SQL Server

i want to insert arbitrary xml into SQL Server. The xml is contained in an XmlDocument object. The column i want to insert into is either nvarchar, ntext, or xml column (If it makes your life easier then you can pick which type it is. Really it's an xml column). Prototype void SaveXmlToDatabase(DbConnection connection, XmlDocume...