Solved

oledbconnection problem with Fill

Posted on 2013-12-13
2
202 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
2 Comments
 
LVL 74

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now