如何通过ADO.NET

时间:2012-07-25 13:33:59

标签: c# sql sql-server-2008 ado.net

我正在使用SQL Server 2008和C#ADO.NET来实现这一目标。

我想使用存储过程将这些数据插入到表SAVEDATA

谢谢

Srosh

2 个答案:

答案 0 :(得分:1)

好吧,您只需编写一个INSERT语句,然后从该表中选择要传入的数据:

CREATE PROCEDURE [dbo].[spSave] (@theDATA As [dbo].[TVP] Readonly)
AS
BEGIN      
    INSERT INTO dbo.SaveResponse(ID, myQuestion, PersonWhoResponses,
                                 Response, [User], [DateTime])

       SELECT 
          ID, myQuestion, PersonWhoResponses,
          Response, [User], [DateTime]
       FROM
          @theDATA
END

答案 1 :(得分:0)

INSERT INTO @theData ( 
  SELECT [ID], [myQuestion], [PersonWhoResponses], [Response] , [User],  [DateTime]
  FROM SAVERESPONSE
  WHERE ...
)