Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Error on Win Server 2008R2 querying Excel 2003 with Jet 4.0

$
0
0
Good Afternoon,

The following code reads distinct dates from a column in an Excel 2003 spreadsheet and populates a drop down combo box.

The development environment is Microsoft Visual Studio 2010 Version 10.0.30319.1 RTMRel
Microsoft Visual Basic 2010 01021-532-2002467-70272

I am doing the development on a machine running Windows 7 and the below subroutine executes without issue.

I need to deploy this on several servers running 64 bit Windows 2008R2 Datacenter edition.

The built executable targets .Net Framework v3.5 and is built as 32 bit by setting x86 as the target CPU in the project properties.

The Jet 4.0 database engine is being used because some of the targed servers for deployment have Office 2003 applications installed so using the later 64 bit ACE 12.0 engine is not an option.

When the application is deployed on a Windows 2008 server, I get an error message 'No value given for one or more required parameters" when the line daData.Fill(dsDataset) executes.

I have searched pretty exhaustively for this error and found many causes and potential solutions but none seem to apply to my particular circumstances.

I don't know if there are potential differences in the jet components between my ddevelopment machine and the target system, or even at this point if I am missng something simple. What I do know is that it works on one machine and not the other and I have not been able to identify a difference that accounts for that fact.

    Private Sub cmdSelectFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSelectFile.Click

        OpenFileDialog1.ShowDialog()

        path = OpenFileDialog1.FileName

        lblPath.Text = path

        Try
            Dim dsDataset As New DataSet()
            Dim strQuery As String
            strQuery = "SELECT DISTINCT [Date Paid] FROM [apage_awc$]" 'order by [Date Paid]"
            MsgBox(strQuery, MsgBoxStyle.Information, "Query")
            Dim strConnString As String
            strConnString = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" & path & ";Extended Properties=""Excel 8.0;HDR=YES;IMEX=1"""
            MsgBox(strConnString, MsgBoxStyle.Information, "Connection String")
            Dim strConn = New OleDbConnection(strConnString)
            MsgBox("OleDbConection created.")
            Dim daData As New OleDb.OleDbDataAdapter(strQuery, strConn)
            MsgBox("Data Adapter created.")
            daData.Fill(dsDataset)
            MsgBox("data set filled.")
            With cmbPayWeekBegin
                .DataSource = dsDataset.Tables(0).DefaultView
                .DisplayMember = "Date Paid"
                .ValueMember = "Date Paid"
                .SelectedIndex = 0
            End With
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

    End Sub



If anyone can point me in a particular direction, I would be most grateful.

Thank you,

Brian Miller

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>