Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

search an access db in vb.net without sql

anubhav12347anubhav12347 Member Posts: 3
i hv an access database "employee" having table "table1". i take a variable a, now whn i enter a=4, i want d record where "id" column consists 4 shud get displayed......this is d code:

Dim a AsInteger
Dim b AsInteger
Dim c AsInteger
Dim d AsInteger
b = 0
d = 1
a = InputBox("abc", "xyz")
Me.BindingContext(DataSet11, "table1").Position = 0
c = Val(DataSet11.Table1.Count)
DoWhile d <= c
If Fix(DataSet11.Table1.idColumn) <> a Then (-------------PROBLEM HERE--------------)
Me.BindingContext(DataSet11, "table1").Position = Me.BindingContext(DataSet11, "table1").Position + 1
Else
b = 1
ExitDo
EndIf
d = d + 1
Loop
If b = 0 Then
MsgBox("Employee number does not exist")
EndIf

wht shud i put in d braces of fix function,do i even need to use any function.

following is an equivalent statement in vb6 :

if ado.recordset.fields(0) <> a then

Comments

  • seancampbellseancampbell Pennsylvania, USAMember Posts: 684 ✭✭✭
    I am really confused by your code.... and your verbage in this post...

    It appears that you are stating that you are having problems with the Fix function... The Fix function requires you to pass it a numeric expression (Integer, Double, Long, Etc).

    I couldn't figure out what the Fix function did, it appears to be a carry over from old VB. One post I saw online stated that someone was using it to create an integer rounded down, if that is what you are using it for I suggest using System.Math.Floor(Number).

    DataSet11.Table1.idColumn is not a number, that is why there is a problem there.

    Hope this helps,
    Sean C
Sign In or Register to comment.