Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 86,244 VB Programmers. There are 2,256 online right now! Ask your question and get quick answers from Dream.In.Code experts. Join the #1 programming help community on the internet! Registration is fast and FREE... Join Now!

Chat LIVE With a VB Expert
Powered by LivePerson.com

Register to Make This Box Go Away!

Visual basic

 
Reply to this topicStart new topic

Visual basic, SQl Queries in vb

ganesh_pawar
post 8 May, 2008 - 09:31 PM
Post #1


New D.I.C Head

*
Joined: 8 May, 2008
Posts: 1



I have need to Search database for Access using SQL Queries for
" Searching Date between 01/01/2008 to 10/01/2008 "
User is offlineProfile CardPM
Go to the top of the page
+Quote Post


PsychoCoder
post 8 May, 2008 - 09:35 PM
Post #2


ToCode || !ToCode

Group Icon
Joined: 26 Jul, 2007
Posts: 5,857

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Please post like this:

Thank you for helping us helping you.
User is online!Profile CardPM
Go to the top of the page
+Quote Post

anand_the_great
post 13 May, 2008 - 12:45 AM
Post #3


New D.I.C Head

*
Joined: 15 Apr, 2008
Posts: 27

Hello Ganesh, if this your first time to do connection, you need to add a component.
Very easy, go to properties, select "References", add the Microsoft ActiveX Data Objects 2.0 Liabrary.
This is a code to insert in command1.

Public Sub Command1_Click()
Dim masql As String
Dim con As New adodb.Connection
Dim rs As New adodb.Recordset
Set con = New adodb.Connection
Set rs = New adodb.Recordset
rs.CursorLocation = adUseClient
con.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & App.Path & "\wage.mdb"
con.Open
CODE

    masql = "SELECT * From Table1 WHERE Date BETWEEN '01/01/2008' And '10/01/2008'"

rs.Open masql, con, adOpenDynamic, adLockOptimistic
rs.MoveFirst
Set DataGrid1.DataSource = rs
End Sub

Take Care.
Anand.

This post has been edited by anand_the_great: 13 May, 2008 - 12:50 AM
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 5/16/08 08:28AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month