Solved

oledbconnection problem with Fill

Posted on 2013-12-13
2
207 Views
Last Modified: 2013-12-20
Dim weekcounter, savehours As Integer
        Dim insertstatement, saveweekcount As String
        'FIRST QUERY WAGEWEEK FOR COUNTER FOR FIRST DAY OF MONTH
        Dim dtNow As Date = Date.Now
        Dim savedate As Date
        Dim dtFirstOfMonth As Date = dtNow.AddDays(-dtNow.Day + 1)
        Dim dt As Date = Date.Parse(dtFirstOfMonth)
        Dim dateString = dt.ToShortDateString()
        Dim Con As OleDbConnection = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Jet OLEDB:Database Password=;Data Source = c:\wages.accdb")
        Dim Dad As OleDbDataAdapter = New OleDbDataAdapter("Select * from WAGEWEEK where WORKDATE =  '" & dateString & " ' ", Con)
        Con.Open()

        ' Create a Data Set
        Dim Dst As DataSet = New DataSet

        ' Fill the Database
'keeps telling me that there is a parameter missing, but there one missing
'if there is a problem with query would I get this error?
        Dad.Fill(Dst)  
        saveweekcount = Dst.Tables(0).Rows(0).Item(1)
        Con.Close()
0
Comment
Question by:javagair
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39718152
Try this modfication:

Dim Dad As OleDbDataAdapter = New OleDbDataAdapter("Select * from WAGEWEEK where WORKDATE =  #" & dateString & "#", Con)

Open in new window

0
 

Author Closing Comment

by:javagair
ID: 39732820
it was the # from shortdate that caused the problem
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question