Click here to Skip to main content
15,911,132 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
string invFolderpath = TextBox1.Text;
string inv_name = txtbox.Text;


DirectoryInfo dirinfo = new DirectoryInfo(invFolderpath);
FileInfo[] filearr = dirinfo.GetFiles();

foreach (FileInfo f1 in filearr)
{

SqlConnection conn = new SqlConnection();

string name = f1.Name;
conn = new SqlConnection(ConfigurationManager.ConnectionStrings["sqlCon"].ToString());//Sql database connection written in web.config file
conn.Open();
SqlCommand cmd;
cmd = new SqlCommand("[sp_Inventory]", conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter p1 = cmd.Parameters.Add("@inv_name", SqlDbType.VarChar, 20);
p1.Value = txtbox.Text;
SqlParameter p2 = cmd.Parameters.Add("@invFolderPath", SqlDbType.VarChar, 20);
p2.Value = invFolderpath;
SqlParameter p3 = cmd.Parameters.Add("@invHasSubFolders", SqlDbType.VarChar, 20);
p3.Value = 1;
SqlParameter p4 = cmd.Parameters.Add("@invFilesCount", SqlDbType.VarChar, 20);
p4.Value = 0;
SqlParameter p5 = cmd.Parameters.Add("@invCreatedBy", SqlDbType.VarChar, 20);
p5.Value = 2;
C#
cmd.ExecuteNonQuery();
            conn.Close();

Here in this code i can read the inventory info but i want to read the file information and display the file size,path,datecreated,etc.Provide me with some code.Thanks
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900