Jump to content
Xtreme .Net Talk

pcaddict

Members
  • Posts

    5
  • Joined

  • Last visited

About pcaddict

  • Birthday 06/24/1988

Personal Information

  • Occupation
    As-Built Designer - Siemens
  • Visual Studio .NET Version
    Visual Studio .NET Professional 2.0
  • .NET Preferred Language
    C#

pcaddict's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Over the past few days I have been working on an application that iterates through dBase files and outputs the information in a listbox or datagrid. I seem to have gotten the connection string right as I don't get an error when I open the dbf file, but, whenever I add in the DataAdapter and DataSet I get an error. It might help to know that I am using VS .NET 2005 and I am trying to connect to the dBase files using ODBC. Below is the code I am using and an image of the error I get. OdbcConnection conn = new OdbcConnection(); conn.ConnectionString = ("Driver={Microsoft dBASE Driver (*.dbf)};DriverID=21;Dbq=I:\\MDT_1.4\\;"); try { // Open Drawing Database conn.Open(); // Query string jobData = "SELECT DWG_NAME, DWG_NUMBER FROM DRAWINGS.dbf"; OdbcCommand cmd = new OdbcCommand(); cmd.CommandText = (jobData); OdbcDataAdapter dbAdapter = new OdbcDataAdapter(jobData, conn); //<---Error begins here (I think) DataSet dtSet = new DataSet(); dbAdapter.Fill(dtSet); DataTable dbTable = dtSet.Tables[0]; foreach (DataRow dbRow in dbTable.Rows) { outputListBox.Items.Add(dbRow["DWG_NAME"].ToString()); } Thanks for your help
  2. Take a look here: http://www.c-sharpcorner.com/winforms/MDIAppsGAG.asp
  3. Here is an attachment of the code since pastebin expired.ConnectToAccess.txt
  4. OK, when I query the database I add the names to the combobox and the corresponding ssn in the array list. When I change the SelectedIndex, my connectToAccess method is again called using the selected employee's ssn. When a name is selected a list of documents related to their name is displayed in a listbox that can be viewed later. The following pastebin shows my (messy) connectToAccess method and the code that is executed when the employee is changed. http://pastebin.com/554758 If anyone knows how to do this better I am open to ideas.
  5. Similar Question I am writting a program that connects to an access database, queries employee names, stores these names in an ArrayList, and are added to the comboBox item list. Currently, I have the program querying the database after I change the selectedIndex of the comboBox but the problem is this, dupelicate names are being added to the comboBox which are out of the Array Index (I am using ArrayList.Clear()). The next thing I have tried is having the comboBox items cleared after the Selected Index is changed but this poses a problem, the current selected index is cleared and there is no telling what employee you are looking at. Are there any other solutions to this problem or do I just have to settle with the selected index being cleared? This is in C# and .NET 2.0 btw Thanks in advance, Patrick
×
×
  • Create New...