Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. OleDbConnection lDbfConnection = new OleDbConnection(connectionString);
  2. try
  3. {
  4. lDbfConnection.Open();
  5.  
  6. OleDbParameter lScript = new OleDbParameter(
  7. "script",
  8. @"create table Result (colums parameters)
  9. OleDbCommand lOleDbCommand = lDbfConnection.CreateCommand();
  10. lOleDbCommand.CommandType = CommandType.StoredProcedure;
  11. lOleDbCommand.CommandText = "ExecScript";
  12. lOleDbCommand.Parameters.Add(lScript);
  13. lOleDbCommand.ExecuteNonQuery();
  14. lOleDbCommand = lDbfConnection.CreateCommand();
  15. lOleDbCommand.CommandText = "insert into Result(colums)
  16.  
  17. SqlConnection lProcConnection = new SqlConnection(lConnect);
  18. SqlCommand lCommand = new SqlCommand(lProcName, lProcConnection);
  19. lCommand.CommandType = CommandType.StoredProcedure;
  20. //input parameters
  21. lCommand.Parameters.Add("ParamName", SqlDbType.Type).Value =SomeValue;
  22. lProcConnection.Open();
  23. ......
  24.  
  25. using(var connection = new SqlConnection("connectionString")) {
  26. using(var command = connection.CreateCommand()) {
  27. command.CommandText = "storedProcedure";
  28. command.CommandType = CommandType.StoredProcedure;
  29.  
  30. var data = new DataTable("TableName");
  31.  
  32. // This will execute the stored procedure and put the data in a data table.
  33. var adapter = new SqlDataAdapter(command);
  34. adapter.Fill(data);
  35.  
  36. // This will create a dbc.
  37. var dbc = @"c:DataData.dbc";
  38. var dbcCreator = new VfpClient.Utils.DbcCreator.DataTableDbcCreator(dbc);
  39.  
  40. // This will create a dbf with the data retrieved from the stored procedure.
  41. dbcCreator.Add(data);
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement