¿Como agregar varios productos a un pedido desde un GridView y registrarlos en Sql Server? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

¿Como agregar varios productos a un pedido desde un GridView y registrarlos en Sql Server?

Buenas noches, estoy desarrollando un proyecto en C#, en este debo agregar varios productos a un pedido, estoy intentado por medio de un GridView, pero no tengo idea de como llevarlo acabo... Alguien que conozca la respuesta y me pueda ayudar? Gracias!!

24th Feb 2019, 4:06 AM
Juan Diego Vega
Juan Diego Vega - avatar
3 Answers
+ 1
Thank you!! 👍
24th Feb 2019, 9:12 PM
Juan Diego Vega
Juan Diego Vega - avatar
0
?
24th Feb 2019, 5:56 PM
Juan Diego Vega
Juan Diego Vega - avatar
0
A gridview is a windows control which is part of the UI. A database is something you want to have in the background but it is something only code should write data in so seperated those layers. You make a connection to the database using a sql connection. You fill a dataadapter with the data from the database You show the data in the dataadapter in the gridview using datasource. https://www.dotnetperls.com/datagridview-tutorial using (SqlCeConnection c = new SqlCeConnection( Properties.Settings.Default.DataConnectionString)) { c.Open(); // 2 // Create new DataAdapter using (SqlCeDataAdapter a = new SqlCeDataAdapter( "SELECT * FROM Animals", c)) { // 3 // Use DataAdapter to fill DataTable DataTable t = new DataTable(); a.Fill(t); // 4 // Render data onto the screen dataGridView1.DataSource = t;
24th Feb 2019, 9:10 PM
sneeze
sneeze - avatar