Questions tagged as 'ado.net'

1
answer

Serialize XML and save in Oracle with C # and ADO

I would like to know 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 for this select below: sele...
asked by 02.04.2014 / 05:03
0
answers

use SqlDependency with [ORM]

I'm developing a service that should perform a procedure whenever a record as a given condition is inserted into the database. However, although you are using SqlDependency , I am not using SqlCommand , it is running and then disc...
asked by 30.03.2017 / 20:33
1
answer

How to get a column in the database, perform a calculation and send to grid

I want to perform a calculation using the value of the field VAL_VIDA_UTIL of my BD and then save the result from calculation in a new variable VAL_DEPRECIACAO and pass to my fieldName, but I am not succeeding. Could someone help me? My code...
asked by 12.07.2016 / 13:31
3
answers

Retrieve MAX value from an SQL column

string var = ""; SqlConnection con = new SqlConnection(Banco._strCon); string sql = "select max(end_id) from endereco"; SqlCommand cmd = new SqlCommand(sql, con); con.Open(); SqlDataReader dr = cmd.ExecuteReader(); if...
asked by 27.10.2015 / 16:26
3
answers

How to generate new code from DBO

I have a table with the name Produtos where I inserted 3 products for testing. Now I'm setting up the product registration form and I need to always generate a sequential product code from the last id already registered + 1. The code I...
asked by 14.07.2016 / 15:26
3
answers

Error concatenating component value in query

Queries in my C # Winforms project are being done through StringBuilder . It was suggested here in the OS that I changed the way to generate the query from Consulta.Append("Select * from...") to @"select * from..." because...
asked by 31.10.2018 / 15:15
2
answers

Can an exception cause the closing of a SqlConnection?

I am building the connection treatment and this question came to mind, even though I could not find a satisfactory answer. So I came here to ask the most experienced programmers. Is there any possibility that when a exception is thrown a...
asked by 06.01.2016 / 17:06
1
answer

Error in DateTime attribute in C # writing to MySQL

I am trying to insert into MySQL database the date of birth of the user, in C # the attribute date_match is of type DateTime and in MySQL the attribute date_match is of type Date , to insert C # I am doing doing so: DateTime nasci...
asked by 28.04.2016 / 13:34
1
answer

Create DataTable Dynamically

I need to create a dynamic DataTable of the genre: List<p> =... List<l>=.... DataTable dt = new DataTable(); foreach (Prod pr in p) { dt.Columns.Add(prod.Nome.Trim()); for (int i = 0; i < l.Count; i++) {...
asked by 17.04.2014 / 17:08
2
answers

Stored Procedure with output parameter being the Id of the last insert. W#

Hello, I'm performing an insert into a table, but I need it to return the ID you just entered. I searched the OUTPUT command but could not solve my problem. I need to do all this using procedures, ie I also need to know how to "get" this...
asked by 13.05.2014 / 21:44