0

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

4
Contributors
15
Replies
16
Views
5 Years
Discussion Span
Last Post by AndreRet
Featured Replies
  • 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) = … Read More

0

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

0

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
0

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.:)

0

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
1

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

Comments
For your effort in solving this.:)
0

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

This question has already been answered. Start a new discussion instead.
Take the time to help us to help you. Please be thoughtful and detailed and be sure to adhere to our posting rules.