Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. DataTable dtChem = new DataTable();
  2. ada.Fill(dtChem); // Fills datatable with data from Excel
  3. cmd.Parameters.Clear();
  4. cmd.CommandText = "dbo.insertDataChem";
  5. cmd.Parameters.AddWithValue("@chemResults", dtChem);
  6. cmd.Parameters.AddWithValue("@eddName", strFileName);
  7. cmd.ExecuteNonQuery();
  8.  
  9. create PROCEDURE [dbo].[insertDataChem]
  10. @chemResults as dbo.udtableDataChem READONLY
  11. , @eddName nvarchar(100) = null
  12. AS
  13.  
  14. BEGIN
  15. INSERT INTO CEDEN_ChemResults
  16. SELECT cr.SampleDate, cr.*, @eddName, CURRENT_TIMESTAMP FROM @chemResults cr
  17. END
  18.  
  19. CREATE TYPE [dbo].[udtableDataChem] AS TABLE(
  20.  
  21. ...
  22.  
  23. [MDL] [decimal](30, 15) NULL, // data type changed
  24. [RL] [decimal](30, 15) NULL, // data type changed
  25. [DilutionFactor] [nvarchar](200) NULL, // original data type
  26. [ExpectedValue] [nvarchar](200) NULL, // original data type
  27.  
  28. ...
  29.  
  30. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement