Arc

Arc

  • NA
  • 17
  • 0

read dbase(dbf) files...OleDB?

Jul 10 2007 5:24 AM

Hey guys, I have some dBase files on my computer that I am trying to read with C#. I  found some VB.NET code that I am trying to convert to C#, but I am getting an error that I can't figure out.

on the  rdr = cmd.ExecuteReader(CommandBehavior.SequentialAccess); line it says I am missing a required Parameter...however, there is only 1 parameter you can put there and that is the correct one.

It is a runtime error and the exact error is  "No value given for one or more required parameters."

Is there something else that looks odd or wrong here? is the connection string wrong? Is the SQL statement causing it? Something else? It is definately happening in the section of code.

Thanks!:wave:

 

[code]
//******************
using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
using MySql.Data.MySqlClient;
using System.Runtime.InteropServices;
using System.Threading;
using System.Data.OleDb;
//************************


string conString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source="+folderPath+";Extended Properties=dBase IV";
                OleDbConnection conn = new OleDbConnection(conString);
                OleDbCommand cmd = conn.CreateCommand();
                OleDbDataReader rdr;
                cmd.CommandText = "SELECT * FROM UF01J1RU.dbf";
                conn.Open();
                rdr = cmd.ExecuteReader(CommandBehavior.SequentialAccess);
[/code]


Answers (6)