1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Database connection issue

Discussion in 'C#' started by WileeDarklight, Sep 8, 2010.

  1. WileeDarklight

    WileeDarklight New Member

    Sep 8, 2010
    Likes Received:
    Trophy Points:
    Hey all!

    I'm rather new to connecting to external sources so bear with me. The error I'm getting is that "No data exists for the row/column."

    the code in question:

    String ConnectionString;
    ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source = C:\\Users;Extended Properties =dBase IV;";
    System.Data.OleDb.OleDbConnection dBaseConnection;
    dBaseConnection = new System.Data.OleDb.OleDbConnection(ConnectionString);
    System.Data.OleDb.OleDbCommand dBaseCommand;
    dBaseCommand = new System.Data.OleDb.OleDbCommand("SELECT FPHONE FROM ADDRESS", dBaseConnection);
    System.Data.OleDb.OleDbDataReader dBaseDataReader;
    dBaseDataReader = dBaseCommand.ExecuteReader(CommandBehavior.SequentialAccess);

    txtFaxNum.Text = dBaseDataReader.GetValue(0).ToString();

    The full data source is in that format (meaning seperated with \\ ) and the coloumn name is correct and that is the name of the table. Can anyone tell me what I'm doing wrong?

Share This Page