2
Answers

A property or indexer may not be passed as an out or ref par

Photo of Erik Borghouts

Erik Borghouts

11y
1.3k
1

Can't get this work properly: (Write to excel)

FormatRange(ref ws.Range[curRange.Offset[1, 0] , gives A property or indexer may not be passed as an out or ref parameter

Any help would be thankfull

  1. public static void WriteDetailData(ref Worksheet ws, string type, ref int row, int col, Hashtable parts, Hashtable refList)
  2. {
  3. Range curRange = null;
  4. Component component = null;
  5. curRange = ws.Cells[row, col];
  6. curRange.Value = type + "Component Summary";
  7. FormatRange(ref curRange, 10, "Green", true, false, false, XlHAlign.xlHAlignLeft);
  8. curRange.Font.Underline = true;
  9. curRange.Offset[1, 0].Value = "Ref-Desig";
  10. curRange.Offset[1, 1].Value = "Part Number";
  11. curRange.Offset[1, 2].Value = "Shape Code";
  12. curRange.Offset[1, 3].Value = "Type";
  13. curRange.Offset[1, 4].Value = "Side";
  14. curRange.Offset[1, 5].Value = "Pin Count";
  15. FormatRange(ref ws.Range[curRange.Offset[1, 0], curRange.Offset[1, 5]], 9, "Red", true, false, true, XlHAlign.xlHAlignCenter);
  16. row += 2;
  17. foreach (Component component_loopVariable in parts.Values)
  18. {
  19. component = component_loopVariable;
  20. curRange = (Range)ws.Cells[row, 1];
  21. curRange.Value = component.RefDes;
  22. curRange.Offset[0, 1].Value = refList[component.RefDes];
  23. curRange.Offset[0, 2].Value = component.Package.Name;
  24. curRange.Offset[0, 3].Value = component.Package.MountType;
  25. curRange.Offset[0, 4].Value = component.Side.ToString().Substring(4);
  26. curRange.Offset[0, 5].Value = component.Package.Pins.Count;
  27. FormatRange(ref ws.Range[curRange.Offset[0, 1], curRange.Offset[0, 5]], 9, "Black", false, false, true, XlHAlign.xlHAlignLeft);
  28. row += 1;
  29. }


Answers (2)

0
Photo of mohan517
NA 7 0 20y
Hi, Thanks for reply. Actually I am trying to develop an application with central database ( Ms SQL). And users connect to this database. Whenever user connects to the central database for first time I application needs to copy all the tables needed by this particular user on his local machine database. So that he can access his local copy when he is offline. And some periodical synchronization to be carried out to keep all copies consistent. I need ur help to know what to use for this kind of application may be ADO.net or SQLDMO or SQL Server CE 2.0. What will be the good one to start with. Thanks, mohan
0
Photo of miker
NA 340 0 20y
... 3. Create DTS package and execute it using dtsrun command line utility. Mike
0
Photo of Andrzej Wegierski
NA 705 0 20y
1. Use Microsoft tool named DTS (Start->Programs->Microsoft SQL Server->Import and Export Data), not c# 2. If You must use C# (see help): - use ExecuteNonQuery() method to create new table in database2 - read data from database1 into datatable1 of dataset (rows status will be unchanged) - create datatable2 and import rows from datatable1 into it to get row status=inserted (may be someone know about better trick ???) - update table created in database2 with data from datatable2