L
Luis Esteban Valencia
This is the code And I have this error in spanish,
translation must be something like ."String has not the correct format".
La cadena de entrada no tiene el formato correcto
the code is:
private void btnUpload_Click(object sender, System.EventArgs e)
{
string ContentType = File1.PostedFile.ContentType;
int Length = System.Convert.ToInt32(File1.PostedFile.InputStream.Length);
byte[] Content = new byte[Length];
File1.PostedFile.InputStream.Read(Content,0,Length);
SqlCommand Command = new SqlCommand("INSERT Into Comprobantes(idproveedor,
archivo, tipoimagen, tamañoimagen, fecha) Values(@idproveedor, @archivo,
@tipoimagen, @tamanñoimagen, @fecha)", sqlConnection1);
SqlParameter idproveedor = new SqlParameter("@idproveedor", SqlDbType.Int);
idproveedor.Value = comboproveedores.SelectedValue;
Command.Parameters.Add(idproveedor);
SqlParameter imagen = new SqlParameter("@archivo", SqlDbType.Image);
imagen.Value = Content;
Command.Parameters.Add(imagen);
SqlParameter imageTypeParameter = new SqlParameter("@tipoimagen",
SqlDbType.NVarChar);
imageTypeParameter.Value = ContentType;
Command.Parameters.Add(imageTypeParameter);
SqlParameter imageSizeParameter = new SqlParameter("@tamanñoimagen",
SqlDbType.Int);
imageSizeParameter.Value = Length;
Command.Parameters.Add(imageSizeParameter);
SqlParameter fecha = new SqlParameter("@fecha", SqlDbType.Int);
fecha.Value = DateTime.Now.ToString();
Command.Parameters.Add(fecha);
try
{
sqlConnection1.Open();
Command.ExecuteNonQuery();
lblmensaje.Text ="Ingresado Satisfactoriamente";
paneladicionar.Visible = false;
}
catch(Exception ex)
{
lblmensaje.Text = ex.Message;
}
finally
{
sqlConnection1.Close();
}
}
translation must be something like ."String has not the correct format".
La cadena de entrada no tiene el formato correcto
the code is:
private void btnUpload_Click(object sender, System.EventArgs e)
{
string ContentType = File1.PostedFile.ContentType;
int Length = System.Convert.ToInt32(File1.PostedFile.InputStream.Length);
byte[] Content = new byte[Length];
File1.PostedFile.InputStream.Read(Content,0,Length);
SqlCommand Command = new SqlCommand("INSERT Into Comprobantes(idproveedor,
archivo, tipoimagen, tamañoimagen, fecha) Values(@idproveedor, @archivo,
@tipoimagen, @tamanñoimagen, @fecha)", sqlConnection1);
SqlParameter idproveedor = new SqlParameter("@idproveedor", SqlDbType.Int);
idproveedor.Value = comboproveedores.SelectedValue;
Command.Parameters.Add(idproveedor);
SqlParameter imagen = new SqlParameter("@archivo", SqlDbType.Image);
imagen.Value = Content;
Command.Parameters.Add(imagen);
SqlParameter imageTypeParameter = new SqlParameter("@tipoimagen",
SqlDbType.NVarChar);
imageTypeParameter.Value = ContentType;
Command.Parameters.Add(imageTypeParameter);
SqlParameter imageSizeParameter = new SqlParameter("@tamanñoimagen",
SqlDbType.Int);
imageSizeParameter.Value = Length;
Command.Parameters.Add(imageSizeParameter);
SqlParameter fecha = new SqlParameter("@fecha", SqlDbType.Int);
fecha.Value = DateTime.Now.ToString();
Command.Parameters.Add(fecha);
try
{
sqlConnection1.Open();
Command.ExecuteNonQuery();
lblmensaje.Text ="Ingresado Satisfactoriamente";
paneladicionar.Visible = false;
}
catch(Exception ex)
{
lblmensaje.Text = ex.Message;
}
finally
{
sqlConnection1.Close();
}
}