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 8117875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:19:12+00:00 2026-06-06T04:19:12+00:00

I am using the following line to store a string in database but am

  • 0

I am using the following line to store a string in database but am currently unable to store it as a single string. Every time it encounters a comma in the string it creates a new row in the database table.

cmd.Parameters.AddWithValue("@ImageURL", String.Join(",", img.ToArray()));

What is the way to go about it?

this is how i have defined the table:

@ImageURL VARCHAR(max)

AS
BEGIN
  SET NOCOUNT ON added to prevent extra result sets from
  interfering with SELECT statements.
  SET NOCOUNT ON;


  Insert statements for procedure here
  insert into 
  DECLARE @String    VARCHAR(100) 

  SET @String =''            

  IF(LEN(@Images)>0)        
  BEGIN        
       DELETE FROM Business_images WHERE BusinessId=@BusinessId        
  END        

  WHILE LEN(@ImageURL) > 0              
  BEGIN           
    SET @String = LEFT(@ImageURL, ISNULL(NULLIF(CHARINDEX(',', @ImageURL) - 1, -1),  LEN(@ImageURL)))              
    SET @ImageURL = SUBSTRING(@ImageURL, ISNULL(NULLIF(CHARINDEX(',', @ImageURL), 0), LEN(@ImageURL)) + 1, LEN(@ImageURL)) 

    insert into Images(ImageURL) values (@String)
  END
END
  • 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-06T04:19:14+00:00Added an answer on June 6, 2026 at 4:19 am
    string specialString = "this is silly, string,,not so special''special";
    using (SqlConnection conn = new SqlConnection(connectionString))
    {
        using (SqlCommand command = new SqlCommand("Insert into t1 (col1) VALUES (@parame)"))
        {
            command.Connection = conn;
            command.Parameters.AddWithValue("@parame",specialString);
            command.ExecuteNonQuery();
        }
    }
    

    FYI: I was able to insert into sql server. In my case col1 is of type nvarchar

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

Sidebar

Related Questions

Using the following line of code in my project I am able to programmatically
I'm using the following line of code in all of my catch statements to
The following line of code is causing me an Exception using (new INVU.API.CallContextStore()) {
I am using CMake to build my project and I have the following line:
I'm using Eclipse IDE and I have the following line in my code: import
I'm using ASP.Net Dynamic Data. I have the following line in my site.master page.
Using the following example, I need to filter out the line containing 'ABC' only,
I am using the following query in an ssrs line chart. It counts how
I am using the following code, in the last line when I play the
I have the following XPATH line: //det[@nItem=1]/prod/cProd That successfully selects the desired node using

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.