I'm getting crazy overhere....$#$#%$

  • Thread starter Thread starter EMW
  • Start date Start date
E

EMW

The MSDN is a great source of information for programmers of .NET
applications, but not for the simple things!!!!

I have been searching for a few days now, my desk is filled with printouts
from books, help pages and web pages, but still cannot find what I'm looking
for.

I'm trying to write a little program, to practice VB.NET, to convert a table
from EXCEL to an ACCESS DATABASE.
I managed to find some examples on how to create a database using ADOX and I
managed to fill a datagrid with the contents of the EXCEL file.

Now I'm trying to find out how to move the info from the datagrid to de
database in a simple and jet fast way.

All the books, web pages and help pages I've been reading all contain
samples on how to open the NorthWind database (which I now really hate), but
nowhere is there a sample that shows how to create a new table, write
something in it and close the database.
And they also always talk about SQL servers which I don't have.

So you now get my frustration.

Can someone please help me, before my insanity becomes permanent?

rg.
Eric
 
Eric,

There is no shortcut to success.

ADO.NET is what you need to populate your database. ADO.NET lets you write
your code - simple and bad - should you need it,
or well laid out and verbose - should you choose to do it.

I recommend a book on ADO.NET by David Sceppa.

If you want a "quickfix", do this.

You have your excel loaded in a dataset (I presume you were able to do this
much).
(Using Oledb)
Now create a datacommand.
Put relevant commandtext in it.
Obviously the right d/b connection as a connection object
do command.executenonquery.

THATS IT DUDE !!! NOW CHILL :)

- SM
 
You should (but I haven't actually tried it) be able to create a table in an
access database (assuming you already have a database file) by creating a
connection to your database using the OleDbConnection object, then you can
create an OleDbCommand and set it to use your connection and set the command
text to something like:

"CREATE TABLE mytable ( myfield1 varchar, myfield2 int.....)"

and then use the OleDbCommand.ExecuteNonQuery method to run the actual
method. That you create your table with the columns you've specified and
then you can go from there. I'm not 100% sure this is actually supported by
the Access drivers, so good luck.

I agree with you on the NorthWind database though!
 
Thanks!

I'm now chilling..... ;)


Sahil Malik said:
Eric,

There is no shortcut to success.

ADO.NET is what you need to populate your database. ADO.NET lets you write
your code - simple and bad - should you need it,
or well laid out and verbose - should you choose to do it.

I recommend a book on ADO.NET by David Sceppa.

If you want a "quickfix", do this.

You have your excel loaded in a dataset (I presume you were able to do this
much).
(Using Oledb)
Now create a datacommand.
Put relevant commandtext in it.
Obviously the right d/b connection as a connection object
do command.executenonquery.

THATS IT DUDE !!! NOW CHILL :)

- SM



and
 
Hi EMW,

Of course that did work, because you did not get any message which said:
"don't do it", so you was looking again taking the advices or did it by
yourself, but you did know it could be solved ".

:-)

Cor
 
Back
Top