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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:20:20+00:00 2026-06-04T10:20:20+00:00

I want to create an SQL statement that inserts a value taken from a

  • 0

I want to create an SQL statement that inserts a value taken from a textBox into a column where any value in that column is NULL

I’m doing it in C# and I was wondering if anyone could help me out…
I wrote a pseudo code version of the command:

string newPhoneNumber = textBox.Text;
SqlCommand cmd = new SqlCommand(
"INSERT INTO table ([Tag ID]) 
 VALUES ('" + newPhoneNumber + "')"; 
 WHERE columnName = NULL" 
cmd.ExecuteNonQuery();
  • 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-04T10:20:21+00:00Added an answer on June 4, 2026 at 10:20 am

    You cannot Use Insert Query with Where Clause

    Since your values are already there, even if you write ColumnName IS NUll as other answers have said, it will not work.

    You have to use Update query

    "Update tablename set first_field_name = first_value, 
      second_field_name = second_field_value WHERE columnName IS NULL";
    

    Moreover NULL is not a value. Its a state. Which means (in front-end) that memory has not been assigned.

    For e.g. strings in C# – if memory is not assigned they are null. They do not have null.

    Note/Warning related to question, not related to answer:

    Always be aware of SQL Injection. Use Parameterised Query (the one with @).

    More on SQL Injection

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

Sidebar

Related Questions

I want to create the following T-SQL statement: SELECT SUM (sa.Amount) as 'SumAmount', SUM(sa.Cost)
I want to create an SQL script that creates a database. Right now, I
I want to create an SQL database for a phonegap application that i am
I want to create a stored procedure (on SQL Server 2005) that fetches a
I have several SQL files that I want to import. An example: CREATE TABLE
I want to create SQL function with JDBC CREATE OR REPLACE FUNCTION TEST.TO_STRING( nt_in
When I create SQL tables and I want to refer to a membership provider
I want to create a table in MS SQL Server 2005 to record details
I want to create a trigger on a SQL Server table. Table has 8
I want to create this table in Oracle. This is only the table SQL

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.