text文本框中数据要和数据库字段数据比对如何写代码

text文本框中数据要和数据库字段数据比对怎么写代码
请教:text文本框中数据要和数据库字段数据比对怎么写代码,如果比对OK,另一个文本框中数据写入数据库的指定字段

------解决方案--------------------
dim strsql as string="select count(*) from 表  where 字段 = ‘“ & textbox1.Text & "'"
cmd.CommandText=strsql
if(ctype(cmd.ExecuteScalar(),integer)>0) then '比对ok
   cmd.CommandText="insert into ....
   ...
end if