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
 Other Development Tools
 VB in relation with SQL server 2000

Author  Topic 

lucylmm
Starting Member

1 Post

Posted - 2005-04-15 : 18:16:09
I am new at this, please if you can bear with me,

Let said you have a screen where you have let said 3 text boxes,
one of then is where the user enter an alpha-numeric entry that could be 8-10 characters long, that data will have to be verified by the the SQL DB, if that is the correct code, in another words
let said I entered BC2345679 and that number is incorrect, then it
should give me an error that this code is not in the database, because all these codes mean something in the database, let said is
the code for certain equipment. How in VB.NET can we create a
code to be able to display this in the screen and what links need to be created so can intercorrelate with the DB SQL server ?

Could you give me an example in Visual Basic, please... thank you.
Honestly, I have a book in VB ... but I need some help.... I am a
beginner. Thank you. I am pulling my hair with this, but I am not given up.

Lucy

Dirty_Howi
Starting Member

12 Posts

Posted - 2005-04-20 : 11:09:05
dim cn as sqlconnection
dim cmd as sqlcommand
dim strSql as string
dim adp as sql dataadapter
dim dts as dataset

cn=new sqlconnection("server=YOURSERVER; uid=userid; pwd=password; database=yourdb")
adp= new sqldataadapter()
dts= new dataset()

strSql="select * from tblwhatever where id=" & textbox1.text
cmd=new sqlcommand(strsql,cn)
adp.selectcommand=cmd

cn.open()
adp.fill(dts)

if dts.rows<>0 then
'data exists
endif
cn.close


try something along those lines.

When i'm right, no one remembers, when i'm wrong no one forgets.
Go to Top of Page
   

- Advertisement -