Ver Mensaje Individual
  #7 (permalink)  
Antiguo 29/06/2013, 19:27
SoVre
 
Fecha de Ingreso: abril-2012
Mensajes: 17
Antigüedad: 12 años, 1 mes
Puntos: 0
Respuesta: no se puede convertir implicitamente int en dataset.datatable

Código:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Text;
using System.IO;
using System.Data;


namespace WindowsFormsApplication1
{
    static class Program
    {
        /// <summary>
        /// Punto de entrada principal para la aplicación.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }

        public static void listFiles()
        {
            try
            {
                DirectoryInfo directory = new DirectoryInfo(@"D:\Jueg");                
                DirectoryInfo[] directories = directory.GetDirectories();
                int N = 0;
                for (int j = 0; j < directories.Length; j++)
                {
                    string dir = ((DirectoryInfo)directories[j]).FullName;
                    DirectoryInfo dirc = new DirectoryInfo(@dir);    
                    FileInfo[] files = dirc.GetFiles("*.*");       
                    for (int i = 0; i < files.Length; i++)
                    {
                        string nombre = ((FileInfo)files[i]).Name;
                        string direccion = ((FileInfo)files[i]).DirectoryName;
                        string fecha = ((FileInfo)files[i]).CreationTime.ToString();

                        canal4videosDataSetTableAdapters.videoTableAdapter videoTA1;
                        videoTA1 = new canal4videosDataSetTableAdapters.videoTableAdapter();
                        videoTA1.insertvideos(nombre, fecha, direccion);

                        N++;
                    }
               }
               MessageBox.Show("Agregados" + N.ToString() + "videos."); 


            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
    }
}
Este es mi codigo actual, funciona perfectamente.
Noto que los datos que le agrego no se incluyen en el dataset, pero cuando vuelvo a cargar el programa aparecen a pesar de que el programa extrae la informacion de dicho dataset, sin usar el boton actualizar, es normal?

Tengo otra duda, como hago para que actualice un archivo que ya existe? que le cambie la informacion, digamos lee el mismo archivo pero en otra carpeta, como hago para que lo actualice en lugar de agregarle otro?
He intentado con "if exist not exist" pero el sql no me los reconoce, hay alguna forma de hacerlo?

Solo eso me faltaria :L