Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 Development Tools
 If, Then, Else Statement
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

11 Posts

Posted - 04/16/2005 :  11:37:04  Show Profile  Reply with Quote
Dim strBarcode 'Barcode entered by user

If strBarcode = (this is what i need) Then
(this also)
Else 'Barcode is invalid
Beep() 'Warn user
lblHelp.Text = "Please enter a valid barcode"
End If

Hi everyone ,

This is my code to validate barcode entered by the user to see if it matches barcode existing from my database. I need a value or name on the other side of my If statement to represent "barcode that exists in my database". After my Then statment, I need my clause to tell my form to allow the barcode. I just don't know the code for this, so i'd figure I'd ask someone more competent and proficient at this.

Thanks in advance,

Flowing Fount of Yak Knowledge

3564 Posts

Posted - 04/18/2005 :  13:19:59  Show Profile  Visit jhermiz's Homepage  Reply with Quote
You'll need to pick up a book on SQL. Your = (this is what I need)... I assume is just some sort of status which tells you whether a bar code exists or not. You really can do a check and an insert in one transaction. That is:

1) Check if the bar code exists...
2) If it doesnt add it else dont add it

Here is a sample sproc:

CREATE PROCEDURE insert_barcode    @barcode varchar(50),

	     FROM MyBarCodes
	     WHERE barcode=@barcode
	    ) return -1  --i'm returning -1 back to the client application..already exists
--if im here then the barcode does not exist and should be inserted...
INSERT INTO MyBarCodes (barcode) Values (@barcode)
RETURN SCOPE_IDENTITY()  --you could return the identity if you need it

Keeping the web experience alive --
Imperfection living for perfection --

Edited by - jhermiz on 04/18/2005 13:20:35
Go to Top of Page

Starting Member

4 Posts

Posted - 01/17/2013 :  22:10:04  Show Profile  Reply with Quote
What kind of barcode you generated? You may input some data that is not included in the barcode standard. You may read tutorial again. I got one tutorial, you may have a look:

bar code generation DLL
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000