How to compare inserted text in (textbox1.text) with
existing database value in (Sqldatasource1) in visual
studio 2005 ?



How to compare inserted text in (textbox1.text) with existing database value in (Sqldatasource1) i..

Answer / amol

Dim strValue As String
strValue = txtValue1.Text

Dim rstData As ADODB.Recordset
rstData = New ADODB.Recordset

rstData.Fields.Append("A",
ADODB.DataTypeEnum.adInteger, 0,
ADODB.FieldAttributeEnum.adFldKeyColumn)
rstData.Fields.Append("B",
ADODB.DataTypeEnum.adVarChar, 10,
ADODB.FieldAttributeEnum.adFldIsNullable)
'rstData.Fields.Append("C",
ADODB.DataTypeEnum.adVarChar, 0)

rstData.Open()
rstData.AddNew()
rstData.Fields("A").Value = "1"
rstData.Fields("B").Value = "Amol"
rstData.Update()
rstData.MoveFirst()
If UCase(Trim(rstData.Fields("B").Value)) =
UCase(Trim(strValue)) Then
MsgBox("True")
Else
MsgBox("False")
End If

Is This Answer Correct ?    3 Yes 2 No

Post New Answer

More Visual Basic Interview Questions

What is the max size of textbox?

1 Answers  


How many MDI(multiple document interface) forms can include in one project(especially in visual basic)?

6 Answers   Satyam, VSS,


___,_____ and ____ container objects. ___ Property is to compress a image in image control. ___,___ and __ are difference between image and picture controls. To set the command button for ESC ___ Property has to be changed. ___,__,___ are the type of combo box? __ no of controls in form. OLE is used for _______ ___ is the control used to call a windows application. Clear property is available in ____,___ control. ___ Property is used to count no. of items in a combobox. ___ is a property to resize a label control according to your caption. ___ property is used to change to ___ value to access a identity column'in datacontrols. _____ is the property to ___,____,____ are valid for recordsource property of dat control. Timer control contains ________ no. of events. ____ property is used to lock a textbox to enter a datas. ____ is the difference between Listindex and Tab index. ____ property of menu cannot be set at run time. _____ collection in recordset used to assign a value from textbox to table columns without making abinding in datacontrol. ___ argument can be used to make a menuitem into bold. ___,___ arguments will be used to run a executable program in shell function ___ property used to add a menus at runtime. ___ VB constant make the menu item in centre. ___ method used to move a recordset pointer in nth position in DAG.

1 Answers   TCS,


what are the Differences between Recordset and Resultsets?

0 Answers   IBS, Lava International,


How do I mimic a toggle button?

0 Answers  






Which method is used to write context Into file?

0 Answers  


Can you create a tabletype of recordset in Jet connected ODBC dbengine.

0 Answers  


What is Collection Objects?

1 Answers  


What is the difference between modal and modaless form in VB?

1 Answers  


How can I create a VBX?

0 Answers  


How do I speed up control property access?

0 Answers  


What is ado in vb?

0 Answers  


Categories