Most voted "ado.net" questions
It’s a set of software components that programmers can use to access data and data services. Created by Microsoft for use with the . Net Framework, it is now used on a smaller scale giving way to more complex technologies.
Learn more…122 questions
Sort by count of
-
17
votes5
answers2401
viewsHow do I merge two results of a query?
I am developing an application in C# and I would like to know how to put together two results of two darlings SQL in one. I have the following code: public List<MalaDireta> ObterMalaDireta() {…
-
16
votes3
answers6549
viewsWhat are providers? What is the difference between OLE DB and ODBC?
I need to read files dbf. I found a tutorial to read the same where the author uses these two providers. I only saw differences in the connection string. What are these providers? What is the…
-
15
votes4
answers6318
viewsHow to display combobox-related value in the textbox?
I am doing a project in C# and SQL Server, and I need the item selected in the combo to display the corresponding values in a textbox. Follow the codes I’ve tried: private void…
-
15
votes8
answers2223
viewsError: not all code paths Return a value
I would like to understand why my code is causing the error not all code paths Return a value using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using…
-
13
votes3
answers6240
viewsWhat would be the best way to make a CRUD for a framework in the most generic way possible?
I’m studying to make a CRUD for a framework but I’m trying some problems to be able to do it in the most generic way possible. For example: have a class Pessoa() I want to do CRUD by passing only…
-
9
votes2
answers1950
viewsClose connection to database c#
I am making a login system and get the message of sql Exception when I try to create new account in the database: MySqlCommand usuaExiste = new MySqlCommand( "SELECT * FROM contas WHERE nome =…
-
9
votes4
answers810
viewsSQL LIKE clause does not work with Sqlparameter
Following the recommendation that the @Maniero fez in that question I decided to parametrize the darlings SQL of my program. Behold: private void btnConsulta_Click(object sender, EventArgs e) { if…
-
8
votes1
answer1158
viewsRecommended form for popular variables with database data
Assuming this fictitious method to obtain database data, say SQL Server: public List<DadosDTO> ObterDados() { try { comand = connectionFactory.CreateCommand(); comand.CommandText = "SELECT…
-
8
votes1
answer374
viewsWhat is ADO.NET for C#?
I’m starting to learn about C# for web applications, and I wanted to know what ADO.NET is and what are the advantages of using it?
-
7
votes1
answer481
viewsPopulate aggregate class from datatable using a Dataset with LINQ C#
I’m having trouble filling an aggregate class in C#. Is it possible using LINQ? Does anyone have any example of how to solve this problem using the return of a DataTable or DataSet? public class…
-
7
votes1
answer451
viewsWhat is the advisable way to mount a query?
What is the advisable way to mount a query in C#? It is advisable to use concatenation with the operator +? For example: query += " WHERE nome LIKE '%" + nome + "%'"; Here follows a query I set as…
-
6
votes7
answers2949
viewsHow to use multiple SQL commands (in the case delete on ORACLE) in one line only on C#?
I made a command because of Foreign Keys, only to plug hole, but it is not working for an invalid character error, I believe it is the ";". I know I’m doing this the wrong way, so I accept…
-
6
votes4
answers1593
viewsChanging connectionStrings from the app.config physically in Runtime
In my app.config I have the following lines of code: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> </configSections> <connectionStrings>…
-
6
votes2
answers519
viewsWhat is the best place to store the connection string?
There are some possible places to store the string connecting. Leave tied inside the code, app.config, Windows registry and configuration file. What is the best place to store string connection?…
-
6
votes1
answer781
viewsConnection pool with ADO.NET and Sqlconnection Dispose, what is correct to do?
I asked a question yesterday about What is the difference between Idisposable implementations? I was implementing a class to help obtain instances of SqlConnection, SqlCommand, SqlDataReader methods…
-
6
votes1
answer2378
viewsWhat are the differences in performance when using querys with EF vs ADO
What is the difference in performance when using the basic query methods SqlQuery<TElement> and ExecuteSqlCommand of Entityframework in relation to directly using the ADO.NET? If there is…
-
6
votes1
answer4952
viewsHow to update a datagridview automatically?
I created an application that will display the data of a particular view in a control datagridview. The entire application is already ready: the data upload, the update button and also the events…
-
6
votes1
answer99
viewsWhy do typed accessors run the process faster?
I was reading an article by how to improve the performance of a Reader data using ADO.NET and in this article he cites the use of Typed Accessors to perform this function, from what I understand it…
-
5
votes1
answer190
viewsParameter for Stored Procedure not identified
I’m having a problem, which would be a mistake saying that there is no parameter being passed to the Procedure. It is running the following code: cmdProcedure.Parameters.AddWithValue("@id", 0);…
-
5
votes3
answers593
viewsFind string in more than one SQL table
I would like to search for a certain string using LIKE in more than 1 table. Here is an example of how I did, which will probably spend a lot of time or will not search in all tables: string SQL1 =…
-
5
votes1
answer1837
viewsWhat are the differences between a Datatable and a Datareader for Mysql queries in C#?
I am creating a C# project with Mysql, my connector follows the standard Singleton and use Mysqldatareader to recover the table data and popular a List so far ok. My problem started when I had to…
-
5
votes2
answers1346
viewsDifference between ADO.NET and Dapper
What are the differences between Orms? When to use one and when to use the other? What are the disadvantages of each?
-
5
votes1
answer66
viewsParameterizing Dataset in C#
I created a search screen with a textbox, one button and a gridview. I would like the search results to appear on this Gridview but I can only do that with one Dataset. In this case I needed to find…
-
5
votes1
answer362
viewsWhat is the best validation strategy before data persists?
I’m used to . NET using C# and Entityframework. And there in the Entity we have the dataanotations. When I create the entity in C#, for example person, just put the datanotaations and the Entity…
-
4
votes1
answer934
viewsError: Registering ? instead of special character only using browser
I am having a problem at the time of saving the data in my ORACLE database. When using my application to fill in the fields and register a string, the special characters as accents for example are…
-
4
votes1
answer103
viewsDatareader blocks using Datareader "Close()"?
I have a little doubt regarding Datareader’s inside using blocks. If my Datareader object is inside a using block, will it be closed at the end of that block? Or do I have to insert the Close…
-
4
votes3
answers2878
viewsWhat is the best way to verify the existence of a record in the database via application?
Today I use a method that sends a COUNT with the record id as a parameter for the database. There is a better, perhaps more performative way to do this?
-
4
votes1
answer1504
viewsAdd line to a datatable
I need to add a row in a table at a given position. I have the following methods: public void criarTabela(DateTime dia) { tabela = new DataTable(); switch (dia.DayOfWeek) { //case DayOfWeek.Monday:…
-
4
votes2
answers569
viewsReturn Datareader to bool field
I need to return a field that is of the type bool: public List<TB_USUARIO> ListarTodos() { var strQuery = "select * from tb_usuario"; using (contexto = new Contexto()) { var retornoDataReader…
-
4
votes1
answer299
viewsHow to take a column in the database, perform a calculation and send it to the grid
I want to perform a calculation using the value of the VAL_VIDA_UTIL field of my BD and then save the result since calculation in a new variable VAL_DEPRECIACAO and pass to my fieldName, but I’m not…
c# sql-server webforms ado.net devexpress-asp.net-ajaxasked 8 years, 2 months ago Fernanda Ferreira 197 -
4
votes2
answers310
viewsWhich object performs best? Sqldatasource or Datatable?
In terms of performance, speed, or even safety, what is the best object to be used as a DataSource? Example, I’m creating a DataSource, to popular a GridView: For SqlDataSource:…
-
4
votes1
answer266
viewsSave dataset C#
I’m searching several tables from the database for a Dataset through a Stored Procedure in the MySQL using the Mysql Workbrenck, but when saving only the first table is saved, my code: Stored…
-
4
votes1
answer682
viewsMaking the Insert in SQL Server in a float field?
I have the following problem in my code, I have a textbox that receives the value 0.900, only when I’m recording this value in the bank, it’s only recording 900, and I need you to record the 0.900…
-
3
votes1
answer151
viewsSerialize XML and save to Oracle with C# and ADO
I wonder if there is something equivalent in Oracle for this select in SQL Server: select NickName, ExternalId1 from Basics where externalId1 = @externalId1 for xml auto, elements; And to this…
-
3
votes1
answer2694
viewsConnection to the database with App.config
How to establish a connection to the Northwind database using App.config and ADO.NET?
-
3
votes1
answer631
viewsODBC does not support reading DBF file?
I’m trying to read a file .dbf following a tutorial I saw on the site of Macoratti (Obs. I think everyone knows). And when executing the method below, is launched a OdbcException with the following…
-
3
votes4
answers4241
viewsHow to get the amount of records in a query in Sqlite?
I am listing the records of a table with the code below: SQLiteCommand comando = new SQLiteCommand("SELECT * FROM Cadastro " +filtro, conn); SQLiteDataReader receber = comando.ExecuteReader(); But…
-
3
votes1
answer329
viewsHow to write bit information to SQL Server database?
I am developing a VB registration system and need help to record the information of a CheckBox in the SQL Server database. The column is in bit in the database, I don’t know how to pass the…
-
3
votes1
answer59
viewsIs the query generated by the Entity Framework valid for use in ADO?
I’m wanting to have a higher performance in a query I perform in the system Consequently use ADO is much faster than Entity Framework To query that it generates when performing the query, could be…
-
3
votes2
answers102
viewsCan an Exception cause a Sqlconnection to close?
I’m building the treatment of a connection and I came up with this question in mind, yet I couldn’t find a satisfactory answer. So I came here to ask the most experienced programmers. Is there any…
-
3
votes3
answers2241
viewsHow to create nonexistent columns in a Datatable?
Here is my query: select u.nome as analista, s.descricao as situacao, count(*) as qtd from tb_projeto p inner join tb_usuario u on u.id_usuario = p.id_usuario inner join tb_situacao s on…
-
3
votes1
answer562
viewsC# Mysql transaction in distinct classes and methods
How do I interact a transaction between 2 methods that are in different classes? In my method where I open the transaction is as follows: public string InserirFuncionarioM(FuncionariosDTO…
-
3
votes1
answer246
viewsCreate second column in Datatable
I have a DataTable where with the code: DT.Column.Add("1ª", gettype(int32)) For I = 1 To 30 DT.Rows.Add(I) Next(I) This For lists column 1 from 1 to 30. 'DT is declared with a new DataTable, in this…
-
3
votes1
answer363
viewsInsert current date in a field
I’m using dataAdapters do . Net to create a project as a BD learning base with C#. I chose an easier path that would be to work most of the time in design mode through the Datasets. The battle I…
-
3
votes1
answer535
views -
3
votes2
answers502
viewsObject Reference not set to an instance of an Object
I know the question is a little subjective, but maybe someone’s been through it and can help me. I have an application developed in C#/Windows Forms/ADO.NET with Firebird database. The error "Object…
-
3
votes1
answer180
viewsVariable with unassigned value within a "for" loop
int i; string cpf; cpf = "11111111111"; DbConnection cnx = ADO_Utils.GetConnection(); DbCommand cmd = ADO_Utils.GetComando(cnx); cmd.CommandType = CommandType.Text; for (i = 1; i <…
-
3
votes1
answer142
viewsNullreferenceexception when calling function
I’m creating some unit tests for a class library that does manipulations in a database. The method being tested is this: public object ExecuteNoQueryOperation ( string spOrSqlInstructions,…
-
3
votes2
answers407
viewsSaving file path in Mysql
I’m having trouble saving file address in the database. When saving the address in the bank it is adding the amount of times I used the OpenFileDialog to save a file. Always save the address like…
-
3
votes3
answers149
viewsHow to generate new code from DBO
I have a table with the name Produtos in which I inserted 3 products for testing. Now I’m assembling the product registration form and I need to always generate a sequential product code from the…