Click here to Skip to main content
15,894,896 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionAjax Editor control Pin
jitendrafaye5-May-10 23:30
jitendrafaye5-May-10 23:30 
AnswerRe: Ajax Editor control Pin
Peace ON5-May-10 23:49
Peace ON5-May-10 23:49 
GeneralRe: Ajax Editor control Pin
jitendrafaye6-May-10 2:43
jitendrafaye6-May-10 2:43 
AnswerRe: Ajax Editor control Pin
Jamil Hallal6-May-10 1:41
professionalJamil Hallal6-May-10 1:41 
Questionsaving the other information to database if no content is present in file upload control using asp.net with c# Pin
developerit5-May-10 22:03
developerit5-May-10 22:03 
AnswerRe: saving the other information to database if no content is present in file upload control using asp.net with c# Pin
Shahriar Iqbal Chowdhury/Galib5-May-10 22:19
professionalShahriar Iqbal Chowdhury/Galib5-May-10 22:19 
AnswerRe: saving the other information to database if no content is present in file upload control using asp.net with c# Pin
Paramhans Dubey6-May-10 0:02
professionalParamhans Dubey6-May-10 0:02 
Questionsaving the images in database like null value Pin
developerit5-May-10 21:14
developerit5-May-10 21:14 
hi iam using asp.net with c#

i have written the code to save the image in database.the code works fine when i browse and upload the picture it will save in database , but some times i have no images so i dont want to upload images that time it is giving error , even though my data base field is allow null

error

System.ArgumentException: The path is not of a legal form.



the code is
===========

SqlCommand cmdsave = new SqlCommand("AddBranchProc11", con);
            cmdsave.CommandType = CommandType.StoredProcedure;
            con.Open();

            cmdsave.Parameters.AddWithValue("@BranchId", txtbranchid.Text);
            cmdsave.Parameters.AddWithValue("@BranchName", txtBranchname.Text);

            cmdsave.Parameters.AddWithValue("@CompanyId", ddlcompanyid1.SelectedItem.Value);
            
            cmdsave.Parameters.AddWithValue("@ContractNo", txtcontractno.Text);
            cmdsave.Parameters.AddWithValue("@Region", ddlRegions.SelectedItem.Value);

            cmdsave.Parameters.AddWithValue("@City", txtcity.Text);
            cmdsave.Parameters.AddWithValue("@Area", txtarea.Text);

            cmdsave.Parameters.AddWithValue("@Address", txtaddress.Text);

            cmdsave.Parameters.AddWithValue("@StartDate", txtstartdate1.Text);
            cmdsave.Parameters.AddWithValue("@EndDate", txtEnd.Text);
            cmdsave.Parameters.AddWithValue("@ContractReminder", ddlcontractreminder.SelectedItem.Value); FileInfo branchinfo = new FileInfo(FileUpload1.PostedFile.FileName.Trim());
            byte[]branchcontent=new byte[branchinfo.Length];
            FileStream branchstream = branchinfo.OpenRead();
            branchstream.Read(branchcontent,0,branchcontent.Length);
            branchstream.Close();
            cmdsave.Parameters.AddWithValue("@ReminderType", ddlremindertype.SelectedItem.Value);
            cmdsave.Parameters.AddWithValue("@BranchPicture",branchcontent);

 if (cmdsave.ExecuteNonQuery()!= 0)
            {

                Functions.ShowAlertMessage("saved");
}


i want to save the information without image also , can you correct my code which helps me
AnswerRe: saving the images in database like null value Pin
Shahriar Iqbal Chowdhury/Galib5-May-10 21:59
professionalShahriar Iqbal Chowdhury/Galib5-May-10 21:59 
AnswerRe: saving the images in database like null value Pin
Abhishek Sur5-May-10 22:20
professionalAbhishek Sur5-May-10 22:20 
AnswerRe: saving the images in database like null value Pin
AnandDesai196-May-10 2:26
AnandDesai196-May-10 2:26 
AnswerRe: saving the images in database like null value Pin
T M Gray6-May-10 9:27
T M Gray6-May-10 9:27 
QuestionSearch bar needed Pin
reogeo20085-May-10 20:06
reogeo20085-May-10 20:06 
AnswerRe: Search bar needed Pin
Ankur\m/5-May-10 21:02
professionalAnkur\m/5-May-10 21:02 
QuestionRead-only checkbox in selectable GridView row Pin
ziopino705-May-10 10:44
ziopino705-May-10 10:44 
QuestionJQuery Database and image URGENT Pin
Anuj Batra`5-May-10 7:28
Anuj Batra`5-May-10 7:28 
AnswerRe: JQuery Database and image URGENT Pin
Not Active5-May-10 7:42
mentorNot Active5-May-10 7:42 
AnswerRe: JQuery Database and image URGENT Pin
Abhishek Sur5-May-10 22:23
professionalAbhishek Sur5-May-10 22:23 
QuestionRegarding Textbox Control. Pin
dayakar_dn5-May-10 7:18
dayakar_dn5-May-10 7:18 
AnswerRe: Regarding Textbox Control. Pin
Yusuf5-May-10 16:39
Yusuf5-May-10 16:39 
AnswerRe: Regarding Textbox Control. Pin
Abhijit Jana5-May-10 18:51
professionalAbhijit Jana5-May-10 18:51 
AnswerRe: Regarding Textbox Control. Pin
Jamil Hallal6-May-10 1:37
professionalJamil Hallal6-May-10 1:37 
QuestionControl to insert several numeber at once Pin
amina895-May-10 4:58
amina895-May-10 4:58 
AnswerRe: Control to insert several numeber at once Pin
Peace ON5-May-10 5:10
Peace ON5-May-10 5:10 
GeneralRe: Control to insert several numeber at once Pin
amina896-May-10 0:30
amina896-May-10 0:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.