5 Replies - 2067 Views - Last Post: 14 May 2011 - 02:14 PM Rate Topic: -----

#1 CodeCapition1  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 30
  • Joined: 23-September 10

vb.net enviroment setup for excel database

Posted 12 May 2011 - 02:44 PM

Ok i have been Google-ing for four days now and still i can find no solution to my problem:(and my brain hurts)
i recently made a windows application that pulls data from a mySQL Database and populates my form but when i was told to use excel instead of MySQL thats when the problems started. while setting up vb to connect to MySQL i found a few articles that explained in good enough detail how to set up vb before ever doing any coding

ie.( boot vb, start windows form project, click project/add reference, click on the COM tab and add the MySQL reference then click ok. next click data/Add new data source, chose database click next, click new connection, choose MySQL data source click continue, enter database info(server, user, password, port) click ok. then start coding connection strings and commands ( which i have no problem with)

my problem i can find all sorts of code to work with excel but i feel i need to go through the same environment set up as with MySQL but i cant figure out how to set it up i only need to read data from excel file to populate my form data ie.( text boxes, labels, datagridview, Ect...)
does anyone know how to set up the development environment to facilitate my use of excel.

or does anyone know of a better way to store and retrieve my data maybe a vb local database ( does that travel with the .exe easily???)

P.S. sorry i don't need code help today I'm pretty good with coding. if this should be posted in another forum please point me to it maybe i can get answers there but this is the best place i know of for development help( and my favorite)

This post has been edited by CodeCapition1: 12 May 2011 - 02:47 PM


Is This A Good Question/Topic? 0
  • +

Replies To: vb.net enviroment setup for excel database

#2 smohd  Icon User is offline

  • Critical Section
  • member icon



Reputation: 1746
  • View blog
  • Posts: 4,409
  • Joined: 14-March 10

Re: vb.net enviroment setup for excel database

Posted 12 May 2011 - 02:55 PM

I think you didnt search the MSDN, look at this:
Excel connectivity from VB.NET
Transfering data to Excel
Answere MSDN quwstion
Was This Post Helpful? 1
  • +
  • -

#3 CodeCapition1  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 30
  • Joined: 23-September 10

Re: vb.net enviroment setup for excel database

Posted 14 May 2011 - 01:14 PM

hi first i would like to thank you for the information it is great


my first problem was the machine i was doing development on didn't have office suite installed on it so i installed it and got a different error
then i saved my excel file in the '.xls' format not the '.xlsx' format now i can see my data in the datagridview YAY!!!

next problem which you might be able to help me with.
this line of code
MyCommand = New System.Data.OleDb.OleDbDataAdapter("select * from [Classes$]", MyConnection)

works and displays all the data and hedders from my excel file now i need to search one row for a specific value and display the column hedder name in listbox. how would i build my "select * from [Classes$]" statement to look like ths ( SELECT * from [Classes$] row(2) all cells WHERE cell.value=0 return column hedder of that cell)

This post has been edited by CodeCapition1: 14 May 2011 - 01:14 PM

Was This Post Helpful? 0
  • +
  • -

#4 smohd  Icon User is offline

  • Critical Section
  • member icon



Reputation: 1746
  • View blog
  • Posts: 4,409
  • Joined: 14-March 10

Re: vb.net enviroment setup for excel database

Posted 14 May 2011 - 01:40 PM

You need a where clause an replace * with a column name
Was This Post Helpful? 1
  • +
  • -

#5 CodeCapition1  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 30
  • Joined: 23-September 10

Re: vb.net enviroment setup for excel database

Posted 14 May 2011 - 02:00 PM

well i need to select all colum hedders where the value of the specific cell!=0 and display all hedders in a listbox like this below picture:
Attached Image
as you can tell i set up this table to be a boolen field
the first record is a single student i need to search his row for all cells with a value not equal to 0 and display the column hedders in a seperate listbox like the picture shows


unless you could give me a better idea for storing and displaying a list of classes taken

This post has been edited by CodeCapition1: 14 May 2011 - 02:03 PM

Was This Post Helpful? 0
  • +
  • -

#6 smohd  Icon User is offline

  • Critical Section
  • member icon



Reputation: 1746
  • View blog
  • Posts: 4,409
  • Joined: 14-March 10

Re: vb.net enviroment setup for excel database

Posted 14 May 2011 - 02:14 PM

You mean you need the data of only one raw? Use WHERE clause
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1