Database connection issue

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

  1. WileeDarklight

    WileeDarklight New Member

    Joined:
    Sep 8, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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);
    dBaseConnection.Open();
    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

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice