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

  • Home
  • SEARCH
  • 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 7816817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:00:49+00:00 2026-06-02T06:00:49+00:00

I have some saved text in a session list that i want to save

  • 0

I have some saved text in a session list that i want to save in a database. Currently,
result holds 4 different strings.

List<string> result = (List<string>)HttpContext.Current.Session["Application"];

foreach (string element in result)
{
    //produce a query string?        
}

I am using oracle database and a query string for the other inserts for example:

string sql = "insert into JOBQUESTIONS (JOBAPPLICATIONID, QUESTIONTEXT, TYPEID, HASCORRECTANSWER, CORRECTANSWER, ISREQUIRED) VALUES (" + JobID + ", \'" + QuestionText + "\', " + TypeID + ", " + HasCorrectAnswer + ", \'" + CorrectAnswer + "\', " + IsRequired + ")";
RunQuery(sql);

So, i need to create a set of values. However keep in mind these are all strings so i will need to have \’ \’ like: \'” + CorrectAnswer + “\’ for all entries of strings or it wont add to the database.

Can i use string builder? If so how?

  • 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-02T06:00:51+00:00Added an answer on June 2, 2026 at 6:00 am

    Why are you building a SQL String (That opens you up to SQL Injection)? I would suggest either using an ORM (Entity Framework is the MSDN ORM, or a sproc that will do this (and use SqlParameters). Or, at minimum you should be using a parameterized string instead of pushing values in directly

    var parameterizedQuery = new SqlCommand(
        "INSERT INTO JOBQUESTIONS (JOBAPPLICATIONID, 
            QUESTIONTEXT, TYPEID, HASCORRECTANSWER, CORRECTANSWER, ISREQUIRED) 
        VALUES (@JobId, '@QuestionText', @TypeID , @HasCorrectAnswer , '@CorrectAnswer',
            @IsRequired)");
    
    parameterizedQuery.Parameters.Add("@JobId", SqlDbType.Int).Value = 123;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have some Spanish content saved in Excel, that I am exporting into
Suppose, I have saved some permissions in the database by using this code: RoleRepository
I have some code in my project that saves an object to the database,
i have some element in my container and want to save all properties of
* I have saved some data from spinner in to the database. But I
I have a List<string> and some saved values taken from a gridview. What I
I have some text like below saved in a text file &lt;b&gt;This is my
I have some calculated values in the core data database that I need to
I have an existing application that has some parts of formatted text-blocks (standard formats
I have some URLs in an Excel file which I have saved as a

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.