i want to access the data from database..i already connected (.mdb database )in my vb. i want to accesss data to text box,combo box from the database...etc plz any one tell the code
Printable View
i want to access the data from database..i already connected (.mdb database )in my vb. i want to accesss data to text box,combo box from the database...etc plz any one tell the code
Thread moved from the 'CodeBank VB6' forum (which is for you to post working code examples, not questions) to the 'Database Development' forum
As you have already been told in another thread, there is a good tutorial at the start of the "Classic VB: ADO" section of our Database Development FAQs/Tutorials (at the top of this forum)
When you have already been given a tutorial, it is rather rude to ask us to spend our time re-writing it specifically for you. Even if somebody was willing to do it, it wont be as good as the one you have been told to look as, because they wont put in anywhere near as much effort as they would for a tutorial that will be read by thousands of people.
Go thru the tutorial, and if you can't solve your issue after that, ask for help with specific issues that you don't understand.
i saw this if u know the coding plz post it........
if u know coding plz tell..........
I have already told you - the code (with explanations) is in the tutorial, why are you asking us to write it again? :mad:
In addition to that, do not bump your threads. For some of the reasons, see this. People will read your thread (and hopefully reply) when they get the time to do so.
i written this code but it shows some error....Code:Private Sub Form_Load()
con.ConnectionString = "Provider=Microsoft.Jet.oledb.4.0;Data Source=" & App.Path & " \AirLines.mdb"
con.Open
rs.Open "Select * from Flight_Details order by SrNo", con, adOpenDynamic
Filling
Values
end sub
----------------------------------------------------------
Sub Values()
Dim i
If rs2.State = 1 Then rs2.Close
rs2.Open "Select max(SrNo) from Flight_Details ", con
i = rs2.Fields(0) + 1
If rs.EOF = True Or rs.BOF = True Then
If txtsr.Text < i Then
MsgBox "Class Not Found", vbInformation, "Airlines"
cmbclasscode.SetFocus
Else
End If
Exit Sub
End If
txtsr.Text = rs.Fields(4)
txtcode.Text = rs.Fields(0)
txtfare.Text = rs.Fields(2)
txtseats.Text = rs.Fields(3)
If rs1.State = 1 Then rs1.Close
rs1.Open "Select Airline_name from Airlines_Master where Aircode ='" & Mid$(rs.Fields(0), 1, 2) & "'"
txtflight.Text = UCase(rs1.Fields(0))
cmbnum.Text = Mid$(rs.Fields(0), 3, 4)
cmbcode.Text = Mid$(rs.Fields(0), 1, 2)
If rs1.State = 1 Then rs1.Close
rs1.Open "Select ClassName from Class_Master where ClassCode='" & rs.Fields(1) & "'", con
If rs1.EOF = True Or rs1.BOF = True Then
MsgBox "No Records To Display", vbInformation, "Airlines"
Exit Sub
End If
cmbclasscode.Text = UCase(rs1.Fields(0))
like sub or function not defined this is the errror i got during compilation.....
Which line did the error highlight?
first line .......
sub or function not defined this is the errror i got during compilation
Please stop posting multiple replies in a short space of time. Instead you should think a bit more carefully before you submit the first one, so that it includes everything you want to tell us.
You need to be more specific about which line it is, because the first line is Private Sub Form_Load() , which could not generate that error.
sub or function not defined this is the error message .
:confused:
We already know that, you have told us 3 times now.
What we don't know (and I have asked twice already) is which line it occurred on.
when i compiled yellow colour is highlighted in the first line.
Well, that error means you are missing something! If you are talking about this line:
vb Code:
con.ConnectionString = "Provider=Microsoft.Jet.oledb.4.0;Data Source=" & App.Path & " \AirLines.mdb"
Make sure AirLines.mdb is in the correct folder (in this case the same one as your exe will be located in) and that you have installed Access on the target computer.
With this line:
vb Code:
Filling
It is complaining because the sub you are calling isn't in your project.