Questions tagged as 'ado.net'

1
answer

Insert data to sql server only if the 3 "insert" were correct

Good afternoon, I am currently filling in 3 tables in my database, so when the data is obtained they are entered in the first table, I get the primary key of the first insert and then fill it in the following two, I tried my code and everything...
asked by 09.11.2017 / 20:55
3
answers

Transform query result to an entity in an array

In my program I have an ADO.NET Entity Data Model with a couple of tables linked to my database. What I want is to make a query to bring me the data of a table and be able to access them as if it were an array. If for example in the entity ther...
asked by 18.08.2017 / 13:59
1
answer

Send stored procedure result of the controller to the view

I need to send the result of my stored procedure from the controller to the view. This is on my controller: using (SqlConnection con = new SqlConnection("data source=DESKTOP-99IPRRD;initial catalog=RecursosHumanos;integrated security=True;M...
asked by 30.10.2018 / 00:29
2
answers

How can I take a data from a DB and add it to another DateTime data in C #?

My question is this: I am using Visual Studio 2015 , and I am programming in C # for Windows Forms , the case that is I have a variable that is stored in a database of SQL Server 2008 , and the data that is there is of type int . What...
asked by 08.11.2016 / 20:37
2
answers

The query expects the parameter @Name that has not been provided

public bool IngresarUsuario(Prueba objeto) { using (SqlConnection cn = Conexion.Conectar("cadenaCon")) { try { cn.Open(); query = ("insert into Pruebas (Id,Nombre,Componente)values (@Id,@Nombre,@Co...
asked by 08.11.2016 / 18:47
3
answers

Error "ExecuteNonQuery: Connection property has not been initialized."

Why do you return the following error?    ExecuteNonQuery: Connection property has not been initialized. Code: public bool IngresarUsuario(Prueba objeto) { using (SqlConnection con = new SqlConnection(strConnection)) { t...
asked by 07.11.2016 / 22:38
1
answer

Problem with MySQL and Visual Studio [error when adding to table] specifically ExecuteNonQuery ();

The error appears on line 43 when trying to insert data. Specifically where it says int filasafectadas = cmd.ExecuteNonQuery(); Here I leave all the code.    MySql.Data.MySqlClient.MySqlException: 'Column count does not match   value c...
asked by 05.10.2018 / 03:33
1
answer

Perform direct consultation

I have my next query in c # I'm using the ADO.NET Entity Framework 4, my query I just want to get the data of two specific columns. public List<clsSalidas> Listar() { try { var lista = contexto.Execut...
asked by 06.01.2018 / 20:45
1
answer

Run two methods but wait for only one

I need to run two methods Metodo1(); Metodo2(); The first one should be executed normally after this I must return to the interface and leave in background the method 2 since it takes a little longer and does not return anything to t...
asked by 08.09.2017 / 15:32
1
answer

Send parameters for SQL command as parameterized variable

I need to send the parameters that I will use in a sql command, I know that it can be done with Dim paramater As New SqlParameter("@fptemp", serializedTemplate) but now the problem comes when I use a parameterizable function to execute th...
asked by 28.02.2017 / 21:20