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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:28:58+00:00 2026-05-26T02:28:58+00:00

Using VB.Net and Sql Server I want to check the user Entry Value. The

  • 0

Using VB.Net and Sql Server

I want to check the user Entry Value.

The User is entering the code in the textbox, before saving to the table, i want to check whethere code is already exist in the table or not.

Tried Code

 cmd = New SqlCommand("Select code from table where code = '" & textbox1.Text & "' ", Con)
        dr = cmd.ExecuteReader()
        While dr.Read()

       End While

If value is exist, then message to the user “Already Exist” other wise save to the table.

Need Vb.net Code Help

  • 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-26T02:28:58+00:00Added an answer on May 26, 2026 at 2:28 am

    Use SELECT COUNT instead and then check for that being greater than zero:

    cmd = New SqlCommand("SELECT COUNT(*) from table where code = '" & textbox1.Text & "' ", con)
    Dim NumRecords as Int32 = cmd.ExecuteScalar
    IF NumRecords > 0 THEN...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using VB.Net and SQL Server I want to compare the textbox value with table
I am using vb.net code and sql server 2005. I have textbox in my
I am using .NET with sql/oracle server. I want to get the schema(datatype,columnname,etc...) of
Using VB.NET and SQL Server 2005 I want to generate a date according to
I want to make a chat server by using .NET technology (C# and SQL
I am using VB.net code and SQL server 2005. I am havng below code
I'm using ASP.net membership system with SQL Server 2000 database. What I want to
I have an Asp.net website using SQL Server. I want to make a website
Using VB.net, C# and SQL Server I want to write a pseudo for my
i want to get data from sql server database in asp.net using NHibernate. what

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.