473,789 Members | 2,662 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to retrieve data from access using ado

1 New Member
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@re diffmail.com
my coding:


Private Sub Command5_Click( )
Dim cn As New ADODB.Connectio n
Dim rs As New ADODB.Recordset
cn.ConnectionSt ring = "Provider=Micro soft.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 3035
pureenhanoi
175 New Member
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@re diffmail.com
my coding:


Private Sub Command5_Click( )
Dim cn As New ADODB.Connectio n
Dim rs As New ADODB.Recordset
cn.ConnectionSt ring = "Provider=Micro soft.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
3014
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 lately I've been wanting to do more stuff with user accounts, and had been eying MySQL for over a year. Finally I've decided to start off small by converting the forum's account system to a MySQL database (and convert the rest later after I'm...
3
1785
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.. Any pointers would be greatly appreciated. TIA
5
2931
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 using as there are many choices to choose from. My database will contain a lot of records. TIA
12
12265
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 slow to retrieve records from sql server. I'm using sqldataadapter.fill method to populate dataset. Parent table contains more than 3,000 records and child table contains more than 10,000 records and grandchild table contains more than 90,000...
5
5808
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 user keyed in cant be retrieve. The connection is made, just that the data cant be retrive. Hope someone can help mi... Thanks. its urgent... =]
5
2442
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 somebody enters part_no, than using Javascript is it possible to connect to the part master and retrieve the division and desc information? I am not allowed to use the PHP because this will require the user to insert the part number on the first...
13
3438
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 of the form which is submit and cancel. After i have clicked submit, the information is stored directly into my corresponding database table. My problem here is i need to retrieve back the information submitted to display all the data that the...
0
914
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 date time picker?.. (erm... i need the codes for this....) the birthday dates are in ms access... then i want to use VB, to retrieve the data using crystal report. how do i go about doing that? anw, im a virgin in VB.NET... thank you so much...
0
1436
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 Threshold Database. I'm trying to retrieve data from Threshold Database. In that table, it has columns of AC250L, AC250R, BC250L, BC250R, AC500L etc.. When i select a name from the combo box, and click presentButton, it will show a smile if the values from...
1
3942
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 using "value" attribute.see for sample <input type="text" name="lastName" maxlength="50" size="20" value="<% If (Request("visitationID") <> "") Then response.Write(rstvalues("lastName")) End If %> "></td> but in TextArea we have no option...
0
9666
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10408
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10199
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10139
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9020
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5417
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.