borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Find command?)Next Topic (PROGRAMMING WEEKEND CRASH COURSE FREE PDF EBOOK) New Topic New Poll Post Reply
AndreaVB Forum : Database : sql server 2000 stmt error
Poster Message
vbLearner
Level: Graduate

Registered: 21-04-2006
Posts: 13

icon sql server 2000 stmt error

Hi guys!

I am using my Sql server 2000

TABLE:TBLPRODINFO
PRODCODE:CHAR(25)
DESCRIPTION:CHAR(25)
PRICE:NUMERIC(9)

note:
the data prodcode entered/stored is not on the exact fields size

prodcode         description                          price        
-------------------------------------------------------------
hp01                 hewlett packard printer       2500
epson                epson stylus c43                 3500

                    

I Want to get the corresponding value of its price with my inputted prodcode by using these code:

txtprodcode.text=hp01

select * from tblprodinfo where prodcode='"& txtprodcode.text &"'"


but it returns zero in value even it has, he can't find any data, but in ms access it can..

Anybody can help me...

thanks guys



26-09-2006 at 03:00 AM
View Profile Send Email to User Show All Posts | Quote Reply
Nick2k3
Level: Big Cheese

Registered: 23-11-2003
Posts: 23
icon Re: sql server 2000 stmt error

you are using CHAR right? with 25 spaces?

try to use VARCHAR to avoid spaces for your codes


or you can do something like this :

select * from tblprodinfo where rtrim(prodcode)='"& txtprodcode.text &"'"





____________________________
Error 404 ...File not found...!!!!

07-10-2006 at 10:51 AM
View Profile Send Email to User Show All Posts | Quote Reply
VYX
Level: Professor


Registered: 16-12-2005
Posts: 70
icon Re: sql server 2000 stmt error

Thank you very much.. .. but i have also a problem in searching with date

table:tblinfo
dategranted:datetime

how  can i search this in like sele like stmt:



select date like "'& txtsearch.text &"'%'"



he didn't display the any data


so what's problem with this...

thanks in advance

16-11-2006 at 11:59 AM
View Profile Send Email to User Show All Posts | Quote Reply
admin
Level: Administrator


Registered: 04-04-2002
Posts: 530
icon Re: sql server 2000 stmt error

try using this string

"SELECT * from tablename WHERE date like '"& txtsearch.text &"%'"


____________________________
AndreaVB

17-11-2006 at 07:49 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : Database : sql server 2000 stmt error
Previous Topic (Find command?)Next Topic (PROGRAMMING WEEKEND CRASH COURSE FREE PDF EBOOK) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder