0

Hello, I have 10 lines of FileUpload (1-10) i have some problem during the upload event. When i put 10 files there is no problem and everything work fine. When i put 3 or 4 files i get error message. Looking for help / solution Pllllease. the message is: "Could not find a part of the path 'H:\iprint\FilesAndStuff" which is the folder that holding the files. i guesse reason is involved to null or someting

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by dnanetwork
0

Post the code that is causing a problem. Be sure to post all relevant code and use code tags:

[code]

...code here....

[/code]

0

This is the cs code. when i upload all the 10 files there is no problem only when i want to upload less then 10 i get an error

protected void plotterNewOrder(object sender, EventArgs e)
    {
        try
        {
            string File1 = FileUpload1.FileName;
            string File2 = FileUpload2.FileName;
            string File3 = FileUpload3.FileName;
            string File4 = FileUpload4.FileName;
            string File5 = FileUpload5.FileName;
            string File6 = FileUpload6.FileName;
            string File7 = FileUpload7.FileName;
            string File8 = FileUpload8.FileName;
            string File9 = FileUpload9.FileName;
            string File10 = FileUpload10.FileName;


            FileUpload1.SaveAs(Server.MapPath("~\\FilesAndStuff\\") + File1);
            FileUpload2.SaveAs(Server.MapPath("~\\FilesAndStuff\\") + File2);
            FileUpload3.SaveAs(Server.MapPath("~\\FilesAndStuff\\") + File3);
            FileUpload4.SaveAs(Server.MapPath("~\\FilesAndStuff\\") + File4);
            FileUpload5.SaveAs(Server.MapPath("~\\FilesAndStuff\\") + File5);
            FileUpload6.SaveAs(Server.MapPath("~\\FilesAndStuff\\") + File6);
            FileUpload7.SaveAs(Server.MapPath("~\\FilesAndStuff\\") + File7);
            FileUpload8.SaveAs(Server.MapPath("~\\FilesAndStuff\\") + File8);
            FileUpload9.SaveAs(Server.MapPath("~\\FilesAndStuff\\") + File9);
            FileUpload10.SaveAs(Server.MapPath("~\\FilesAndStuff\\") + File10);
 SqlConnection SqlNewConn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["iprintdDB"]);
            SqlCommand SqlNewCmd = new SqlCommand("INSERT INTO orders ([orderOffice],[contactMan],[projectName],[account],[orderAddress],[payAddress],[orderPhone],[payPhone],[email],[dateReciev],[File1],[copies1],[color1],[File2],[copies2],[color2],[File3],[copies3],[color3],[File4],[copies4],[color4],[File5],[copies5],[color5],[File6],[copies6],[color6],[File7],[copies7],[color7],[File8],[copies8],[color8],[File9],[copies9],[color9],[File10],[copies10],[color10],[finish],[bookFinish],[comments],[pen1],[pen2],[pen3],[pen4],[pen5],[pen6],[pen7],[pen8],[pen9],[pen10],[pen11],[pen12],[pen13],[pen14],[pen15],[pen16],[col1],[col2],[col3],[col4],[col5],[col6],[col7],[col8],[col9],[col10],[col11],[col12],[col13],[col14],[col15],[col16],[name1],[address1],[cop1],[name2],[address2],[cop2],[name3],[address3],[cop3],[name4],[address4],[cop4],[name5],[address5],[cop5],[name6],[address6],[cop6],[name7],[address7],[cop7],[name8],[address8],[cop8]) VALUES (@orderOffice,@contactMan,@projectName,@account,@orderAddress,@payAddress,@orderPhone,@payPhone,@email,@dateReciev,@File1,@copies1,@color1,@File2,@copies2,@color2,@File3,@copies3,@color3,@File4,@copies4,@color4,@File5,@copies5,@color5,@File6,@copies6,@color6,@File7,@copies7,@color7,@File8,@copies8,@color8,@File9,@copies9,@color9,@File10,@copies10,@color10,@finish,@bookFinish,@comments,@pen1,@pen2,@pen3,@pen4,@pen5,@pen6,@pen7,@pen8,@pen9,@pen10,@pen11,@pen12,@pen13,@pen14,@pen15,@pen16,@col1,@col2,@col3,@col4,@col5,@col6,@col7,@col8,@col9,@col10,@col11,@col12,@col13,@col14,@col15,@col16,@name1,@address1,@cop1,@name2,@address2,@cop2,@name3,@address3,@cop3,@name4,@address4,@cop4,@name5,@address5,@cop5,@name6,@address6,@cop6,@name7,@address7,@cop7,@name8,@address8,@cop8)", SqlNewConn);
SqlNewCmd.Parameters.Add("@orderOffice", SqlDbType.VarChar).Value = orderOffice.Text;
            SqlNewCmd.Parameters.Add("@contactMan", SqlDbType.VarChar).Value = contactMan.Text;
            SqlNewCmd.Parameters.Add("@projectName", SqlDbType.VarChar).Value = projectName.Text;
            SqlNewCmd.Parameters.Add("@account", SqlDbType.VarChar).Value = account.Text;
            SqlNewCmd.Parameters.Add("@orderAddress", SqlDbType.VarChar).Value = orderAddress.Text;
            SqlNewCmd.Parameters.Add("@payAddress", SqlDbType.VarChar).Value = payAddress.Text;
            SqlNewCmd.Parameters.Add("@orderPhone", SqlDbType.VarChar).Value = orderPhone.Text;
            SqlNewCmd.Parameters.Add("@payPhone", SqlDbType.VarChar).Value = payPhone.Text;
            SqlNewCmd.Parameters.Add("@email", SqlDbType.VarChar).Value = email.Text;
            SqlNewCmd.Parameters.Add("@dateReciev", SqlDbType.DateTime).Value = DateTime.Today;
            SqlNewCmd.Parameters.Add("@File1", SqlDbType.VarChar).Value = File1;
            SqlNewCmd.Parameters.Add("@copies1", SqlDbType.VarChar).Value = copies1.Text;
            SqlNewCmd.Parameters.Add("@color1", SqlDbType.VarChar).Value = color1.SelectedValue;
            SqlNewCmd.Parameters.Add("@File2", SqlDbType.VarChar).Value = File2;
            SqlNewCmd.Parameters.Add("@copies2", SqlDbType.VarChar).Value = copies2.Text;
            SqlNewCmd.Parameters.Add("@color2", SqlDbType.VarChar).Value = color2.SelectedValue;
            SqlNewCmd.Parameters.Add("@File3", SqlDbType.VarChar).Value = File3;
            SqlNewCmd.Parameters.Add("@copies3", SqlDbType.VarChar).Value = copies3.Text;
            SqlNewCmd.Parameters.Add("@color3", SqlDbType.VarChar).Value = color3.SelectedValue;
            SqlNewCmd.Parameters.Add("@File4", SqlDbType.VarChar).Value = File4;
            SqlNewCmd.Parameters.Add("@copies4", SqlDbType.VarChar).Value = copies4.Text;
            SqlNewCmd.Parameters.Add("@color4", SqlDbType.VarChar).Value = color4.SelectedValue;
            SqlNewCmd.Parameters.Add("@File5", SqlDbType.VarChar).Value = File5;
            SqlNewCmd.Parameters.Add("@copies5", SqlDbType.VarChar).Value = copies5.Text;
            SqlNewCmd.Parameters.Add("@color5", SqlDbType.VarChar).Value = color5.SelectedValue;
            SqlNewCmd.Parameters.Add("@File6", SqlDbType.VarChar).Value = File6;
            SqlNewCmd.Parameters.Add("@copies6", SqlDbType.VarChar).Value = copies6.Text;
            SqlNewCmd.Parameters.Add("@color6", SqlDbType.VarChar).Value = color6.SelectedValue;
            SqlNewCmd.Parameters.Add("@File7", SqlDbType.VarChar).Value = File7;
            SqlNewCmd.Parameters.Add("@copies7", SqlDbType.VarChar).Value = copies7.Text;
            SqlNewCmd.Parameters.Add("@color7", SqlDbType.VarChar).Value = color7.SelectedValue;
            SqlNewCmd.Parameters.Add("@File8", SqlDbType.VarChar).Value = File8;
            SqlNewCmd.Parameters.Add("@copies8", SqlDbType.VarChar).Value = copies8.Text;
            SqlNewCmd.Parameters.Add("@color8", SqlDbType.VarChar).Value = color8.SelectedValue;
            SqlNewCmd.Parameters.Add("@File9", SqlDbType.VarChar).Value = File9;
            SqlNewCmd.Parameters.Add("@copies9", SqlDbType.VarChar).Value = copies9.Text;
            SqlNewCmd.Parameters.Add("@color9", SqlDbType.VarChar).Value = color9.SelectedValue;
            SqlNewCmd.Parameters.Add("@File10", SqlDbType.VarChar).Value = File10;
            SqlNewCmd.Parameters.Add("@copies10", SqlDbType.VarChar).Value = copies10.Text;
            SqlNewCmd.Parameters.Add("@color10", SqlDbType.VarChar).Value = color10.SelectedValue;
            SqlNewCmd.Parameters.Add("@finish", SqlDbType.VarChar).Value = finish.SelectedValue;
            SqlNewCmd.Parameters.Add("@bookFinish", SqlDbType.VarChar).Value = bookFinish.SelectedValue;
            SqlNewCmd.Parameters.Add("@comments", SqlDbType.VarChar).Value = comments.Text;
            SqlNewCmd.Parameters.Add("@pen1", SqlDbType.VarChar).Value = pen1.Text;
            SqlNewCmd.Parameters.Add("@pen2", SqlDbType.VarChar).Value = pen2.Text;
            SqlNewCmd.Parameters.Add("@pen3", SqlDbType.VarChar).Value = pen3.Text;
            SqlNewCmd.Parameters.Add("@pen4", SqlDbType.VarChar).Value = pen4.Text;
            SqlNewCmd.Parameters.Add("@pen5", SqlDbType.VarChar).Value = pen5.Text;
            SqlNewCmd.Parameters.Add("@pen6", SqlDbType.VarChar).Value = pen6.Text;
            SqlNewCmd.Parameters.Add("@pen7", SqlDbType.VarChar).Value = pen7.Text;
            SqlNewCmd.Parameters.Add("@pen8", SqlDbType.VarChar).Value = pen8.Text;
            SqlNewCmd.Parameters.Add("@pen9", SqlDbType.VarChar).Value = pen9.Text;
            SqlNewCmd.Parameters.Add("@pen10", SqlDbType.VarChar).Value = pen10.Text;
            SqlNewCmd.Parameters.Add("@pen11", SqlDbType.VarChar).Value = pen11.Text;
            SqlNewCmd.Parameters.Add("@pen12", SqlDbType.VarChar).Value = pen12.Text;
            SqlNewCmd.Parameters.Add("@pen13", SqlDbType.VarChar).Value = pen13.Text;
            SqlNewCmd.Parameters.Add("@pen14", SqlDbType.VarChar).Value = pen14.Text;
            SqlNewCmd.Parameters.Add("@pen15", SqlDbType.VarChar).Value = pen15.Text;
            SqlNewCmd.Parameters.Add("@pen16", SqlDbType.VarChar).Value = pen16.Text;
            SqlNewCmd.Parameters.Add("@col1", SqlDbType.VarChar).Value = col1.Text;
            SqlNewCmd.Parameters.Add("@col2", SqlDbType.VarChar).Value = col2.Text;
            SqlNewCmd.Parameters.Add("@col3", SqlDbType.VarChar).Value = col3.Text;
            SqlNewCmd.Parameters.Add("@col4", SqlDbType.VarChar).Value = col4.Text;
            SqlNewCmd.Parameters.Add("@col5", SqlDbType.VarChar).Value = col5.Text;
            SqlNewCmd.Parameters.Add("@col6", SqlDbType.VarChar).Value = col6.Text;
            SqlNewCmd.Parameters.Add("@col7", SqlDbType.VarChar).Value = col7.Text;
            SqlNewCmd.Parameters.Add("@col8", SqlDbType.VarChar).Value = col8.Text;
            SqlNewCmd.Parameters.Add("@col9", SqlDbType.VarChar).Value = col9.Text;
            SqlNewCmd.Parameters.Add("@col10", SqlDbType.VarChar).Value = col10.Text;
            SqlNewCmd.Parameters.Add("@col11", SqlDbType.VarChar).Value = col11.Text;
            SqlNewCmd.Parameters.Add("@col12", SqlDbType.VarChar).Value = col12.Text;
            SqlNewCmd.Parameters.Add("@col13", SqlDbType.VarChar).Value = col13.Text;
            SqlNewCmd.Parameters.Add("@col14", SqlDbType.VarChar).Value = col14.Text;
            SqlNewCmd.Parameters.Add("@col15", SqlDbType.VarChar).Value = col15.Text;
            SqlNewCmd.Parameters.Add("@col16", SqlDbType.VarChar).Value = col16.Text;
            SqlNewCmd.Parameters.Add("@name1", SqlDbType.VarChar).Value = name1.Text;
            SqlNewCmd.Parameters.Add("@address1", SqlDbType.VarChar).Value = address1.Text;
            SqlNewCmd.Parameters.Add("@cop1", SqlDbType.VarChar).Value = cop1.Text;
            SqlNewCmd.Parameters.Add("@name2", SqlDbType.VarChar).Value = name2.Text;
            SqlNewCmd.Parameters.Add("@address2", SqlDbType.VarChar).Value = address2.Text;
            SqlNewCmd.Parameters.Add("@cop2", SqlDbType.VarChar).Value = cop2.Text;
            SqlNewCmd.Parameters.Add("@name3", SqlDbType.VarChar).Value = name3.Text;
            SqlNewCmd.Parameters.Add("@address3", SqlDbType.VarChar).Value = address3.Text;
            SqlNewCmd.Parameters.Add("@cop3", SqlDbType.VarChar).Value = cop3.Text;
            SqlNewCmd.Parameters.Add("@name4", SqlDbType.VarChar).Value = name4.Text;
            SqlNewCmd.Parameters.Add("@address4", SqlDbType.VarChar).Value = address4.Text;
            SqlNewCmd.Parameters.Add("@cop4", SqlDbType.VarChar).Value = cop4.Text;
            SqlNewCmd.Parameters.Add("@name5", SqlDbType.VarChar).Value = name5.Text;
            SqlNewCmd.Parameters.Add("@address5", SqlDbType.VarChar).Value = address5.Text;
            SqlNewCmd.Parameters.Add("@cop5", SqlDbType.VarChar).Value = cop5.Text;
            SqlNewCmd.Parameters.Add("@name6", SqlDbType.VarChar).Value = name6.Text;
            SqlNewCmd.Parameters.Add("@address6", SqlDbType.VarChar).Value = address6.Text;
            SqlNewCmd.Parameters.Add("@cop6", SqlDbType.VarChar).Value = cop6.Text;
            SqlNewCmd.Parameters.Add("@name7", SqlDbType.VarChar).Value = name7.Text;
            SqlNewCmd.Parameters.Add("@address7", SqlDbType.VarChar).Value = address7.Text;
            SqlNewCmd.Parameters.Add("@cop7", SqlDbType.VarChar).Value = cop7.Text;
            SqlNewCmd.Parameters.Add("@name8", SqlDbType.VarChar).Value = name8.Text;
            SqlNewCmd.Parameters.Add("@address8", SqlDbType.VarChar).Value = address8.Text;
            SqlNewCmd.Parameters.Add("@cop8", SqlDbType.VarChar).Value = cop8.Text;

            SqlNewConn.Open();
            SqlNewCmd.ExecuteNonQuery();
            SqlNewConn.Close();

            try
            {
                SmtpClient iPrintMail = new SmtpClient();
                string iPrintOrderID = string.Format("התקבלה הזמנה חדשה באתר מאת: {0}", orderOffice);
                string iPrintMailMessage = string.Format("שם הלקוח המזמין: {0}", contactMan);
                MailMessage Mailmsg = new MailMessage(email.Text, "print@iprintd.com");
                Mailmsg.Subject = iPrintOrderID;
                Mailmsg.Body = iPrintMailMessage;
                iPrintMail.Send(Mailmsg);
            }
            catch (Exception Exx)
            {

                Response.Write(Exx);
            }

            Response.Redirect("orderConfirm.aspx");
        }
        catch (SqlException Ex)
        {

            Response.Write("שגיאה בניסיון התחברות למסד נתונים" + Ex);
        }
    }
}

Edited by happygeek: fixed formatting

0

name the error..?

in u r database File1....File8 null status is uncheked i.e
Null values are not allowed...so could be a chance of an error..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.