Solved

oledbconnection problem with Fill

Posted on 2013-12-13
2
206 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 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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

Title # Comments Views Activity
.NET 2008 VB and C# 6 39
VB.NET 2008 Winforms Signing 13 32
Generate Unique ID in VB.NET 21 67
Code enhancement 4 22
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.

828 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