Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9245241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:13:21+00:00 2026-06-18T09:13:21+00:00

I am using file upload control..in asp.net..storing files first in temp directory and then

  • 0

I am using file upload control..in asp.net..storing files first in temp directory
and then after when user clicks on save I move files from temp to my desired location.
Problem is I have to used for loop and make 5 times trip to database for my insert query to insert 5 records.But I want to write single query for that.
I know that I can send my image name as well as image path comma seprated.but since i dont have enough knowledge of sql,I dont know how to split comma seprated files in sql and then using cursor insert them.So i request some one write me a sample query over here.so that i can proceed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T09:13:22+00:00Added an answer on June 18, 2026 at 9:13 am

    Use can pass dataset as xml to stored procedure and in stored procedure you can insert multiple rows in one go using openXML

    C# code for passing dataset object as xml to stored procedure

             ...................................
    
        DataSet ds = new DataSet(); // assume dataset has records(in table object)
        string xmlString = ds.GetXml();
    
        SqlCommand cmd = new SqlCommand("your procedure name", "your Connection object");
        cmd.Parameters.Add(new SqlParameter("@XmlString",xmlString);
                 ...................................
    

    stored procedure, bulk insert using openXML

          ...................................
    
      DECLARE @XMLDocPointer INT    
      EXEC sp_xml_preparedocument @XMLDocPointer OUTPUT, @XmlString    
    
       INSERT INTO Employee
       (Name, Email, PhoneNo)    
       SELECT Name,Email,PhoneNo   
       FROM OPENXML(@XMLDocPointer,'/ROOT/DATA',2)    
       WITH  (Name VARCHAR(50),-- '@Name',     
             Email VARCHAR(50),-- '@Email',     
             PhoneNo VARCHAR(50) --'@PhoneNo')     
    
       EXEC sp_xml_removedocument @XMLDocPointer    
            ...................................
    

    read this for complete example
    http://www.codeproject.com/Articles/417181/Bulk-Insertion-of-Data-Using-Csharp-DataTable-and

    ===================================================================

    if you looking for split string in sql
    then below is the sql function that you need to create in sqlserver

    create function f_split(@SourceSql varchar(8000),@StrSeprate varchar(10))
    returns @temp 
    table(a varchar(100))
    begin    
     declare @i int    
     set @SourceSql=rtrim(ltrim(@SourceSql)) 
     set @i=charindex(@StrSeprate,@SourceSql)    
     while @i>=1    
     begin        
      insert @temp values(left(@SourceSql,@i-1))        
      set @SourceSql=substring(@SourceSql,@i+1,len(@SourceSql)-@i)        
      set @i=charindex(@StrSeprate,@SourceSql)    
     end    
     if @SourceSql<>'\'       
     insert @temp values(@SourceSql)    
     return 
    end
    go
    

    and how to call

    select * from dbo.f_split('1,2,3,4,5',',')
    

    and then using cursor you can insert all

    for split function, see this post http://social.msdn.microsoft.com/forums/en-US/transactsql/thread/4126a010-6885-4eb0-b79c-c798c90edb85

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using the asp.net file upload control is very easy, i'm trying to squeeze it
I want to upload a file using FileUpload Control in asp.net and i'm using
i am using asp.net 2.0 in my project using file upload control , so
I am using Ajax File Upload control in ASP.NET 4 using c#. The same
I m using asp.net 2.0 without AJAX. The file path in the fileupload control
I want to get the type of file uploaded using the ASP.NET FileUpload control.
I was using a File Upload functionality in ASP.NET .If the users are using
I'm trying to add a file upload control to my ASP.NET MVC 2 form
I am using ASP.NEt MVC . I want to upload .zip files for which
I have a simple ASP .Net file upload control on a page. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.