I am developing an application in .NET Compact for Windows Embedded with C # language and SQL Compact 3.5 database.
The application has 3 columns with several rows, I have 2 columns that show in their rows an information already established in the database and in the third column would be what the user types, this is mounted in a DataGrid where call the information of the database, I have a Textbox where the information that goes in the third column is placed and two buttons one to edit and another to save.
The following problem occurs:
When I want to run from the computer where I am developing, I get a error nativo 25009
that does not stop me from passing the line to open the database, on the other hand when I run it on the device, it throws me a mapping error. I already check the path and the path of the database is the correct disk C/Carpeta Base de datos
and inside there is my base de datos .sdf
,
I attach the source code:
private void btnEditar_Click(object sender, EventArgs e)
{
DataGridCell currentCell;
string currentCellData;
// Se obtiene el texto a poner en la celda actual.
currentCellData = txtCantidad.Text;
// Se obtiene la celda actual.
currentCell = dtFrutas.CurrentCell;
// Se asigna la data a la celda actual.
dtFrutas[currentCell.RowNumber, currentCell.ColumnNumber] = currentCellData;
txtCantidad.Text = "";
}
private void btnGuardar_Click(object sender, EventArgs e)
{
SqlCeConnection conn = null;
//SqlCeConnection con = new SqlCeConnection("Data Source =\"\Program Files\FrutayPastelino\MisPedidos.sdf\";");
SqlCeConnection con = new SqlCeConnection("Data Source = C:\Base de datos\MisPedidos.sdf");
//con.Open();
SqlCeCommand ad = new SqlCeCommand("UPDATE Fruta SET Cantidad = @cantidad WHERE Codigo_Integra = @codigo_integra", con);
con.Open(); // Error nativo 25009 en el ordenador.
try
{
ad.Parameters.AddWithValue("@cantidad",txtCantidad.Text);
ad.Parameters.AddWithValue("@codigo_integra", " "); //ERROR DE MAPEO EN EL DISPOSITIVO
//ad.ExecuteNonQuery();
MessageBox.Show("Pedido bien");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
con.Close();
ad.Dispose();
}
}
private void Form1_Load(object sender, EventArgs e)
{
// TODO: esta línea de código carga datos en la tabla 'misPedidosDataSet.Fruta' Puede moverla o quitarla según sea necesario.
this.frutaTableAdapter.Fill(this.misPedidosDataSet.Fruta);
}