Hi ,

i need to add values in my Grid-View at Run time and save it to the database.i am displaying a particular folder filenames in gridview now after displaying need to add two columns and insert values at runtime in it and then save it to the database.i tried various things like by creating a function and calling and inserting values but at run-time this Does not work. i am novice in this field and Don't know much about this ..please help.

code for displaying folder filenames :

FolderBrowserDialog folderDlg = new FolderBrowserDialog();
              folderDlg.ShowNewFolderButton = true;
            // Show the FolderBrowserDialog.
             DialogResult result = folderDlg.ShowDialog();
             String[] files = Directory.GetFiles(@"C:\Users\LENOVO\Desktop\RemotePlay");
            DataTable table = new DataTable();
            table.Columns.Add("File Name");
            table.Columns.Add("Sequence");
            table.Columns.Add("Delay");
            for (int i = 0; i < files.Length; i++)
            {
                FileInfo file = new FileInfo(files[i]);
                table.Rows.Add(file.Name);
            }
             dataGridView1.DataSource = table;

Recommended Answers

All 3 Replies

You telling us "it does not work" does not help us much in trying to solve your problem.
Please be more specific and verbose about WHAT "does not work"

ddanbe i resolved my question myself but now Another problem with datatype has occurred. i have this field in database called Delay its related to playing/displaying image or video files. i want to set datatype of that field so far int,varchar not working its storing Zero(0) value instead of user inputted data.so what datatype must be used ?

You should have posted this question in a new thread.
Look in the documentation for your SQL brand, in MySQL you could use the blob datatype.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.