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

 All Forums
 Development Tools
 ASP.NET
 If, Then, Else Statement

Author  Topic 

OfMartin
Starting Member

11 Posts

Posted - 2005-04-16 : 11:37:04
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,
OfMartin890@yahoo.com

jhermiz

3564 Posts

Posted - 2005-04-18 : 13:19:59
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),
AS
BEGIN
SET NOCOUNT ON

IF EXISTS(SELECT *
FROM MyBarCodes
WHERE barcode=@barcode
) return -1 --i'm returning -1 back to the client application..already exists
ELSE
--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
Set NOCOUNT OFF
End
GO



Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page

qrcodenet
Starting Member

4 Posts

Posted - 2013-01-17 : 22:10:04
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:http://www.tarcode.com/barcode-aspnet/generate-guide.html



bar code generation DLL
Go to Top of Page
   

- Advertisement -