473,387 Members | 1,483 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

inserting many records in 1 single connection

in VB.net (windows form):
the function is reading 2 colums x 1000 rows, from an excel file, loading
them in a datatable then add the datatable to a dataset.

How can I send this dataset to the database to insert all those records in a
table in one single connection ?

thanks
Nov 21 '05 #1
4 1103
Hi,
Maybe this will help.

http://support.microsoft.com/default...b;en-us;321686
http://www.dotnet247.com/247referenc...38/190168.aspx
Ken
-------------------
"zino" <zi**@newsgroups.nospam> wrote in message
news:22**********************************@microsof t.com...
in VB.net (windows form):
the function is reading 2 colums x 1000 rows, from an excel file, loading
them in a datatable then add the datatable to a dataset.

How can I send this dataset to the database to insert all those records in a
table in one single connection ?

thanks
Nov 21 '05 #2
Zino,

Read your Excel file in a dataset using this kind of code (Sheet1 can be
another name)
\\\
Dim ConnectionString As String
ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\test1\myExcel.xls;" & _
"Extended Properties=""Excel 8.0;HDR=NO"""
Dim Conn As New System.Data.OleDb.OleDbConnection(ConnectionString )
Dim da As New System.Data.OleDb.OleDbDataAdapter _
("Select * from [Sheet1$]", Conn)
Dim ds As New DataSet
da.Fill(ds, "Sheet1")
///

Than change the names of the columns in your dataset to the columns in your
database table, open a connection in your database, create a dataadapter and
do a fillschema.

http://msdn.microsoft.com/library/de...chematopic.asp

Than you can even use the commandbuilder (I am not sure of this so you
should try that and otherwise create your own updatecommand) and do an
update of that dataset in the database

I hope this helps?

Cor
Nov 21 '05 #3
thank you for your help.
I used the commandBuilder to send the dataSet to the database
Nov 21 '05 #4
Hi Zino,

Did you still have any concern on this issue, please feel free to post here?
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: stacey.michols | last post by:
I am trying to insert records via ASP, with a user that has only write access to the table (db_datawriter, db_denydatareader). That way, if the server is ever compromised, the access information...
5
by: geskerrett | last post by:
I have a program that reads records from a binary file and loads them into an MS-SQL Server database. It is using a stored proc, passing the parameters. I am using pywin32 to create a...
13
by: Jan | last post by:
Hi I have a database that I use to keep track of the sales promotions that we send to companies. I normally send a mailing based on a subset of the companies in the database (found using the...
2
by: a | last post by:
NEW Post Here's my best guess at how to insert this dataset.... the code runs, but no new records are added to the sql table. I've read and split a delimited text file into a dataset. It...
3
by: James Alba | last post by:
Hey all, I am accessing an ms access database using .NET and C#. Like so, /* Create the database connection. */ connection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data...
2
by: P of Dhump | last post by:
Hello, I'm new to asp.net and ado.net so please reply considering that in mind. I'm trying to insert some records which are in a .CSV file but the insert is working double time. i have 744 records...
10
by: Roger Withnell | last post by:
I'm using ASP, VBScript and SQL Server. I'm also using UTF-8 character set and so my codepage is 65001 and SQL Server datatype nvarchar. I can insert unicode characters correctly into the...
2
by: AlexanderDeLarge | last post by:
Hi! I got a problem that's driving me crazy and I'm desperately in need of help. I'll explain my scenario: I'm doing a database driven site for a band, I got these tables for their discography...
2
by: hakkatil | last post by:
Hi to all, I have a page that inserts excel sheet to access database. I am using asp. What I want to do is to check the inserting record if it is in the database. Basicly checking the dublicate...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.