473,396 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

how to retrieve data from access using ado

1
hi i want to retrieve data from access through vb6.0 program but its not working.
either sort out my error or help me with correct coding.
thanks in advance !!!!!!!
mail me at himanshu_s27@rediffmail.com
my coding:


Private Sub Command5_Click()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\raghu project\dt.mdb;Persist Security Info=False"
If cn.State = adStateOpen Then
cn.Close
End If
cn.Open
rs.Open "select * from Table1 ", cn, adOpenStatic
While rs.BOF = False
If rs.State = adStateOpen Then
rs.Close
End If
On Error GoTo error2
rs.Open "select * from Table1 where Location=" & Val(Combo1.Text) & " and F_Time = " & Val(Text1.Text) & " and To_Time = " & Val(Text2.Text) & "" , cn, adOpenStatic

Exit Sub
error2:
MsgBox Err.Description
Exit Sub
rs.MoveNext
Wend
cn.Close
Set cn = Nothing

End Sub
Jul 28 '07 #1
1 3007
pureenhanoi
175 100+
hi i want to retrieve data from access through vb6.0 program but its not working.
either sort out my error or help me with correct coding.
thanks in advance !!!!!!!
mail me at himanshu_s27@rediffmail.com
my coding:


Private Sub Command5_Click()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\raghu project\dt.mdb;Persist Security Info=False"
If cn.State = adStateOpen Then
cn.Close
End If
cn.Open
rs.Open "select * from Table1 ", cn, adOpenStatic
While rs.BOF = False
If rs.State = adStateOpen Then
rs.Close
End If
On Error GoTo error2
rs.Open "select * from Table1 where Location=" & Val(Combo1.Text) & " and F_Time = " & Val(Text1.Text) & " and To_Time = " & Val(Text2.Text) & "" , cn, adOpenStatic

Exit Sub
error2:
MsgBox Err.Description
Exit Sub
rs.MoveNext
Wend
cn.Close
Set cn = Nothing

End Sub
Hehe, tell me who teach you working with database. Very complicated and non-understandable code.
Jul 28 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: Daniel Tonks | last post by:
First, please excuse the fact that I'm a complete MySQL newbie. My site used forum software that I wrote myself (in Perl) which, up until now, has used flat files. This worked fine, however...
3
by: Mal Reeve | last post by:
Hello, I am looking for an easy way to retrieve a file from a given website.. I am building an app that will retrieve a .csv file then TRANSFER text it into a table for further processing.. ...
5
by: Roy Gourgi | last post by:
Hi, I am used to working in Visual FoxPro and I would like to be able to create a database and store and retrieve information from it. What is the simplest way to do it and what should I be...
12
by: jaYPee | last post by:
I have currently using a dataset to access my data from sql server 2000. The dataset contains 3 tables that is related to each other. parent/child/grandchild relationship. My problem is it's very...
5
by: Hannie | last post by:
I am currently doing my project using VB.NET I have a database which contains all my data that the user key in. The problem is, when i click the retrieve button on the form, the details that the...
5
by: ggk517 | last post by:
We are trying to develop an Engineering application using PHP, Javascript with Informix as the back-end. Is it possible to retrieve data using Javascript but by accessing the Database. Say...
13
by: kev | last post by:
Hi all, I have created a database for equipments. I have a form to register the equipment meaning filling in all the particulars (ID, serial, type, location etc). I have two buttons at the end...
0
by: Julz | last post by:
Hello!.. erm, i need help... how do u write the code that needs to retrieve Birthday months and Another month (e.g. Janauary to May birthday babies)?... im using combo box... should i use the...
0
by: tigger | last post by:
Hi there, I'm having problems retrieving data from Access database using Visual basic 2005. My database is called Actual_Database and it has a few tables. One of them is called...
1
by: gudipati | last post by:
hi,i have one problem.actually we can retrieve data from access. what is my requirement is when i retrieve data from access i want to store in text areas. finely,we can store if they r textboxes...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.