Hi,
I need some held.
I want to transfer the datatable into my database by using OleDb so please help me.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Feb 13, 2015, 5:25 AM
https://msdn.microsoft.com/en-us/library/system.data.common.dataadapter.update(v=vs.110).aspx
http://csharp.net-informations.com/dataadapter/updatecommand-oledb.htm
hope this will help you.
Mohammad Hamza KhanPosted Feb 13, 2015, 5:10 AM
Munesh SharmaPosted Feb 13, 2015, 5:05 AM
http://www.codeproject.com/Articles/17169/Copy-Data-from-a-DataTable-to-a-SQLServer-Database
Create a User-Defined TableType in your database:
CREATE TYPE [dbo].[MyTableType] AS TABLE(
[Id] int NOT NULL,
[Name] [nvarchar](128) NULL
)
and define a parameter in your Stored Ptocedure:
CREATE PROCEDURE [dbo].[InsertTable]
@myTableType MyTableType readonly
AS
BEGIN
insert into [dbo].Records select * from @myTableType
END
and send your DataTable directly to sql server:
using (var command = new SqlCommand("InsertTable") {CommandType = CommandType.StoredProcedure})
{
var dt = new DataTable(); //create your own data table
command.Parameters.Add(new SqlParameter("@myTableType", dt));
SqlHelper.Exec(command);
}
Jignesh TrivediPosted Feb 13, 2015, 4:44 AM
Need more information.
what language are you using for transfer the data?
have you done any code?