Click here to Skip to main content
16,005,038 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone,

I have created a table in a dataset and I want pass a new table to the database.

How can I do this?

Thanks for any help
Posted
Updated 16-Dec-10 22:01pm
v2
Comments
Dalek Dave 17-Dec-10 4:01am    
Edited for Grammar and Syntax.

This possible only with SQL Server 2008

VB
Dim table As New DataTable("temp")
Dim col1 As New DataColumn("col1", System.Type.GetType("System.Int32"))
Dim col2 As New DataColumn("col2", System.Type.GetType("System.String"))
Dim col3 As New DataColumn("col3", System.Type.GetType("System.DateTime"))
table.Columns.Add(col1)
table.Columns.Add(col2)
table.Columns.Add(col3)


'Create a command object that calls the stored proc
Dim command As New SqlCommand("usp_AddRowsToMyTable", conn)
command.CommandType = CommandType.StoredProcedure

'Create a parameter using the new type
Dim param As SqlParameter = command.Parameters.Add("@MyTableParam", SqlDbType.Structured)
param.Value = table
 
Share this answer
 
Comments
Mostafa Elsadany 17-Dec-10 4:18am    
no is possible with xml
create a new table in dataset and writexml
so i want change xml to database
im sorry i not need to create a procedure
i have a new datatabel in dataset
as
dtaset.table.add(newtable);

so i want
upadte this dataset to create a new table in database
 
Share this answer
 
Comments
Simon_Whale 17-Dec-10 6:02am    
please add comments to peoples answer instead of replying with answers as they don't get an email of your comments.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900