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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:11:35+00:00 2026-05-23T02:11:35+00:00

I have demonstrate following SQL between SQL and VS 2005: update expbill set convrate=null

  • 0

I have demonstrate following SQL between SQL and VS 2005:

update expbill set convrate=null
where transID=2
and companyID=114

The above T-SQL is working fine on SQL Server and updates the rows as NULL, but the same transaction is not working in VS 2005, using this SQL query:

string update_exp = " update expbill set convrate = " + null + "" +
                " where companyID = '" + label1.Text + "'" + 
                " and invno = '" + textBox1.Text + "'";
SqlCommand updated_cmd  = new SqlCommand(update_exp , con);
updated_cmd.ExecuteNonQuery();

The above SQL query throws an error

Incorrect syntax near the key words
“where”

I want to know that if the same SQL statement works in SQL but not in Visual Studio. Is there any difference of NULL function between SQL and VS 2005??

  • 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-05-23T02:11:35+00:00Added an answer on May 23, 2026 at 2:11 am

    For the record:

    string update_exp = @"
    update expbill set convrate=@rate
    where companyID=@cid
    and invno=@iid";
    SqlCommand updated_cmd  = new SqlCommand(update_exp , connection);
    updated_cmd.Parameters.AddWithValue("rate", DBNull.Value);
    updated_cmd.Parameters.AddWithValue("cid", label1.Text);
    updated_cmd.Parameters.AddWithValue("iid", textBox1.Text);
    updated_cmd.ExecuteNonQuery();
    

    This will keep you safe. DO NOT CONCATENATE TEXT TO MAKE SQL. If that is typical of your coding style, I need you to realise that your code is dangerously exposed and can be abused and broken accidentally or maliciously. Pain. Lots of pain.

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

Sidebar

Related Questions

I have created the following LINQ query to demonstrate the problem: string[] dateStrings =
I have been using the following code (with jQuery v1.4.2) to set the 'selected'
I have the following situation. This is a code snippet, edited to demonstrate the
The following code demonstrates a weird problem I have in a Turbo C++ Explorer
Have you ever seen any of there error messages? -- SQL Server 2000 Could
I have the following scenario: Class_A - method_U - method_V - method_X - method_Y
I have the following code where I am handling an event twice. However I
I wrote the following heap debugger in order to demonstrate memory leaks, double deletes
Take the following example (created purely to demonstrate the point). What I am trying
I'm encountering a consistency issue with an E_DEPRECATED message. I have the following snippet

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.