sir/madam
i need a help.......how to search a string from oracle to vb.......my codings are not working properly so please correct it........i attach my codings below...

accse.Open "Provider=MSDASQL.1;Password=tiger;Persist Security Info=True;User ID=scott;Data Source=facultydetails"

rsfdcse.Open "select * from csefacultydetails where name= " & "'&name1.Text '", accse, adOpenDynamic, adLockOptimistic

If Not rsfdcse.RecordCount = 0 Then
If rsfdcse.Fields(0) = Val(name1.Text) Then


name1.Text = rsfdcse.Fields(0)
designation.Text = rsfdcse.Fields(1)
qualification.Text = rsfdcse.Fields(2)
department.Text = rsfdcse.Fields(3)
dateofjoining.Value = rsfdcse.Fields(4)
sex.Text = rsfdcse.Fields(5)
address.Text = rsfdcse.Fields(6)
contactno.Text = rsfdcse.Fields(7)
community.Text = rsfdcse.Fields(8)
emailid.Text = rsfdcse.Fields(9)
MsgBox "RECORD FOUND"
End If
accse.Close
rsfdcse.Close
Else
MsgBox "RECORD NOT FOUND"

End If

What is not working ?

Are you getting any error message ?

your information is not clear..and please use code tags

the error message is
"either BOF or EOF is true,or the current record has been deleted.
requested operation requires a current record.

accse.Open "Provider=MSDASQL.1;Password=tiger;Persist Security Info=True;User ID=scott;Data Source=facultydetails"

rsfdcse.Open "select * from csefacultydetails where name= " & "'&name1.Text '", accse, adOpenDynamic, adLockOptimistic

If Not rsfdcse.RecordCount = 0 Then
If rsfdcse.Fields(0) = Val(name1.Text) Then" it showing error in this line "


name1.Text = rsfdcse.Fields(0)
designation.Text = rsfdcse.Fields(1)
qualification.Text = rsfdcse.Fields(2)
department.Text = rsfdcse.Fields(3)
dateofjoining.Value = rsfdcse.Fields(4)
sex.Text = rsfdcse.Fields(5)
address.Text = rsfdcse.Fields(6)
contactno.Text = rsfdcse.Fields(7)
community.Text = rsfdcse.Fields(8)
emailid.Text = rsfdcse.Fields(9)
MsgBox "RECORD FOUND"
End If
accse.Close
rsfdcse.Close
Else
MsgBox "RECORD NOT FOUND"

End If

accse.Open "Provider=MSDASQL.1;Password=tiger;Persist Security Info=True;User ID=scott;Data Source=facultydetails"

rsfdcse.Open "select * from csefacultydetails where name= " & "'&name1.Text '", accse, adOpenDynamic, adLockOptimistic

is incorrect -

accse.Open "Provider=MSDASQL.1;Password=tiger;Persist Security Info=True;User ID=scott;Data Source=facultydetails" 'THIS LOOKS LIKE MS SQL AND NOT ORACLE< NOT SURE THOUGH.... Make sure you have the correct connection string....

'This for Oracle - CHECK YOUR CONN STRING, IT IS INCORRECT
Provider=OraOLEDB.Oracle;dbq=localhost:1521/XE;Database=myDataBase;User Id=myUsername;Password=myPassword;

rsfdcse.Open "select * from csefacultydetails where name= " & "'" & name1.Text & "'", accse, adOpenDynamic, adLockOptimistic

'Correct recordset call

As per my sql statement, I have added the " ' " apostrophized characters.:)

now the errors are cleared but its not retrieving the strings from back end......

sir please ..... clear my doubts

Rather change the following -

name1.Text = rsfdcse.Fields(0)
designation.Text = rsfdcse.Fields(1)
qualification.Text = rsfdcse.Fields(2)

to

name1.Text = rsfdcse!Firstfieldname
designation.Text = rsfdcse!Secondfieldname
qualification.Text = rsfdcse!Thirdfieldname

Change the fieldnames to what you have in your table, for instance "name1.Text = rsfdcse!name" etc....:)

That should solve all your problems here, please mark this as solved, found at the bottom of this page, thanks.:)

even then it's not retrieving the data's sir .... but it not showing errors

i solved the problem sir... by default the string from back-end will converted to integer .... so once again we need to convert the integer to string ... i attach my codings for reference.... but thanks for you reply posting sir... it's very helpful.. thanks a lot

Dim s As Integer

accse.Open "Provider=MSDASQL.1;Password=tiger;Persist Security Info=True;User ID=scott;Data Source=facultydetails"
rsfdcse.Open "select * from csefacultydetails where name= " & "'" & name1.Text & "'", accse, adOpenDynamic, adLockOptimistic

s = Val(rsfdcse!Name)

If Not rsfdcse.RecordCount = 0 Then
If CStr(s) = Val(name1.Text) Then
name1.Text = rsfdcse!Name
designation.Text = rsfdcse!designation
qualification.Text = rsfdcse!qualification
department.Text = rsfdcse!department
dateofjoining.Value = rsfdcse!dateofjoining
sex.Text = rsfdcse!sex
address.Text = rsfdcse!address
contactno.Text = rsfdcse!contactno
community.Text = rsfdcse!community
emailid.Text = rsfdcse!emailid
MsgBox "RECORD FOUND"
End If
accse.Close
Else
MsgBox "RECORD NOT FOUND"
End If

Show me your connection code. I think the problem lies there.

it sloved the problem ... i posted the coding before itself

Dim s As Integer

accse.Open "Provider=MSDASQL.1;Password=tiger;Persist Security Info=True;User ID=scott;Data Source=facultydetails"
rsfdcse.Open "select * from csefacultydetails where name= " & "'" & name1.Text & "'", accse, adOpenDynamic, adLockOptimistic

s = Val(rsfdcse!Name)

If Not rsfdcse.RecordCount = 0 Then
If CStr(s) = Val(name1.Text) Then
name1.Text = rsfdcse!Name
designation.Text = rsfdcse!designation
qualification.Text = rsfdcse!qualification
department.Text = rsfdcse!department
dateofjoining.Value = rsfdcse!dateofjoining
sex.Text = rsfdcse!sex
address.Text = rsfdcse!address
contactno.Text = rsfdcse!contactno
community.Text = rsfdcse!community
emailid.Text = rsfdcse!emailid
MsgBox "RECORD FOUND"
End If
accse.Close
Else
MsgBox "RECORD NOT FOUND"
End If

commented: For your effort in solving this.:) +7

Cool. It's good to see someone putting in the effort and solve thir own problem, well done!:)

Cool. It's good to see someone putting in the effort and solve thir own problem, well done!:)

sir i have doubt in automatic sms ... i created the thread .... please help me to slove that problem too

I saw it. Will help soon... :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.