|
I need to Export Fields in a table into another Database Table on a Remote machine, at the moment I Export the records one by one and delete the records as I go along. This is very slow over a 28k connection that I need to use.(3 records per second or so, I am dealing with 1000s of records)
I would love to take all the records at once, dump the on the remote machine and then delete the lot!
I can make use of a Dataset to get all the records but how do I specify what and how to export this to another connection???
Leon v Wyk
|
|
|
|
|
Well, a DataSet can be written to an implementation-independent XML file using DataSet.WriteXml() . Since DataSet is also marked with SerializableAttribute and implements ISerializable , you can serialize this normally to a file yourself. It also derives from MarshalByValueComponent , which means that you can use it in remoting as a remote, pass-by-value object. See the documentation for DataSet for what else is available.
Reminiscent of my younger years...
10 LOAD "SCISSORS"
20 RUN
|
|
|
|
|
Doing them in a set wont speed anything up more for you. Best is to perhaps export the table to a temporary access database, zip the file , send it to other side, etc ,etc. Access tends to compress very well.
Leon v Wyk wrote:
at the moment I Export the records one by one and delete the records as I go along. This is very slow...I am dealing with 1000s of records
I can picture that
leppie::AllocCPArticle(Generic DFA State Machine for .NET);
|
|
|
|
|
Hi, I want to add a new row to a datatable, which I have done. It works perfectly. I then did the dataTable1.AcceptChanges() in the belief that it would save my changes to the database. It did not do this, does anyone have any ideas how to do this?
|
|
|
|
|
Did you add the row back to the rows collection and call Update on the dataAdapter? The code should look like this:
DataRow row = dataTable.NewRow();
row["Column1"] = "blah";
row["Column2"] = "blech";
dataTable.Rows.Add( row );
dataAdapter.Update( dataSet, "TableName" );
dataSet.AcceptChanges();
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
ok the application config xml file is great for applications but what if I create a namespace / class that will be compiled as a dll and used in other application, where would or rather should I stick it configuration "defaults" in the host application config xml file or should it have it's own file?
Thanks
Rob
|
|
|
|
|
Definitely use the 'configuration "defaults" in the host application config xml'. In general, if you are building a separate dll for binary re-use, you probably don't want the library (dll) itself to ever be concerned about application level settings and serializing them. Even if they are settings specific to the dll, they are settings that will be collected from the user in whatever application you are using and then passed into whatever objects you use from the dll upon instatiation.
You can also use the registry to store the values from your main app. Then, when you want to use an object from your dll, pass in the values after obtaining them back from the registry (or XML) to the object constructor.
Hope that makes sense.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
I built a console app for testing. Is there a simple way to get
Console.WriteLine("Hello World");
to print to the IDE Output window rather than the Console window?
|
|
|
|
|
Try
Debug.WriteLine("Hello World");
... and don't forget the
using System.Diagnostics;
|
|
|
|
|
I wrote my own command in Crystal Reports 9, I want to set the DataSource at runtime.
StaffHoursReport staffHoursReport = new StaffHoursReport();
foreach( Table t in staffHoursReport.Database.Tables )
{
t.SetDataSource( Db.DataSource );
}
Where Db.DataSource is a static string. It works for all the tables in my Report but not for the Command I made. I also tried
t.Location = Db.DataSource;
but this works for all the tables but throws an exception on any Commands. The SetDataSource does not throw any exceptions but it prompts for the database path when the report is being created for display. And then it says log in failed if i type in the path to the database.
The only way this report works is if I have the database in the path specified in the report designer. But this is no good, it will be on different machines all the time.
Please help, thanks alot.
|
|
|
|
|
public class Class2
{
private Class1[][] var;
public Class2
{
var = new Class1[9][]
{
new Class1[9]
{
new Class1(.....),
new Class1(.....),.....
},
new Class1[9]
.....
}
}
}
when i debug this, there's an Exeption at the underlined position: Invalid Parameter used
What did i wrong?
|
|
|
|
|
Frankly, I haven't done a whole lot with multidimensional arrays in C#, however, I can say this--the syntax you are using looks really strange and I'm not sure what you are trying to accomplish. I don't know if the code you have provided here is just pseudo-code or the real thing, but as far as I can tell, you have all kinds of problems. Here's how I interpret your code, but with a more conventional syntax:
public class Class2
{
private Class1[][] var;
public Class2()
{
var = new Class1[9][];
var[0] = new Class1[2];
var[0][0].Member1 = "Bob was here";
var[0][0].Member2 = "Testing...testing";
var[0][1].Member1 = "Is this thing on?";
}
}
Looks to me like you just have a syntax problem. If you'll explain exactly what you are trying to do, I can help a little more. I am just trying to provide you with proper syntax here.
Good luck.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Replace the underlined line with the following:
var = new Class1[][]
|
|
|
|
|
Hi,
I'm currently trying to develop a COM+ server component which receives data passed to it by a client and stores that data into a database. So far I have the client talking to the server but nothing appears to happen. Watching the component in the Component Services reveals that the object is being created and is pooling as expected. Yet it doesn't appear to do anything else. When I run the code in a standalone version it does the job perfectly! Can anyone help me to figure out what I'm missing?
Thanks in advance.
Graham
|
|
|
|
|
Put some System.Diagnostics.Trace.WriteLine and use DBMon from the SDK or SysInternal's DebugView[^] to see where it's failing.
ORACLE One Real A$#h%le Called Lary Ellison
|
|
|
|
|
Thanks, it does help if you know about these wonderful trace routines. I've located the problem and it appears to be due to the way I'm trying to connect to the target database.
Thanks again,
Graham
|
|
|
|
|
First guess is user credentials - check to see what user it is running under in com+, then check if that user is allowed to use the db.
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Don't know, but you may find my article helpful.
You should see a transaction go in when you register the component for the first time, then for each time you commit the root object that has RequiresNew agaist it.
"Je pense, donc je mange." - Rene Descartes 1689 - Just before his mother put his tea on the table.
Shameless Plug - Distributed Database Transactions in .NET using COM+
|
|
|
|
|
Thank you all for your help. It turns out that the COM+ component couldn't find the database DLL. According to the trace in Debug Viewer it attempted to download the DLL from the System32 directory. I copied the file into that directory and it's now working perfectly.
Thanks again!
Graham
|
|
|
|
|
I have a datatable, with two columns. I want to find out how it is possible to count all the values in the 1st column. I want to be able to see which row has the highest number. There is a reason for me doing it this way, rather than making a query do the same thing. Thanks in advance.
|
|
|
|
|
sum()
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
This may seem a bit stupid replying to my own answer, but as I found out what it is, I thought I might share it.
Ok, this is bad code, but you get the idea:
int test1 = 0;
int test2 = 0;
foreach(DataRow myRow in myTable.Rows)
{
test1 = System.Int32.Parse(myRow[0].ToString());
if (test2 <= test1)
{
test2 = test1 + 1;
}
}
|
|
|
|
|
Hi,
I have created a datagrid having source as one table. but the column style I have specified separately for each column of the table some of which are DataGridComboboxColumn. Things till now are working fine - I am able to view all the foreing table entries properly in combobox. The code is as shown below..
UserComboTextCol.MappingName = obTableVerboseInfo.ColumnName;
UserComboTextCol.HeaderText = obTableVerboseInfo.ColHeaderName;
UserComboTextCol.Width = 120;
UserComboTextCol.ColumnComboBox.DataSource = dsRefTreeSelected.Tables[obTableVerboseInfo.RefTableName].DefaultView;
UserComboTextCol.ColumnComboBox.DisplayMember = obTableVerboseInfo.DisplayColumn;
UserComboTextCol.ColumnComboBox.ValueMember = obTableVerboseInfo.RefColumnName;
Do not worry about the values on right side of =.
But now I want this datagrid for update purpose as well. i.e. if user makes some modifications to the combo control, I should get the foreign key value of the new selected member. All that I get is the display column which can be duplicate in table !! Once the user has updated the datagrid, how do I put the values back to the table by converting them to the actual values from display column ? Can anyone help me ?
Thanks.
Rohit
|
|
|
|
|
I say this, not as a criticism so much as a way to help you; you've really got to try to phrase your questions a little clearer. Here's how I would have asked what I think you're trying to ask:
"I have a datagrid on a form I use to display a single table. The datagrid was originally intended for display only, but I now want to use it to update records as well. I have converted one of the columns so it now displays a combo box with a list of selections. I just don't understand, when I click my update button, how I can get the foreign key of the current record. Can someone point me in the right direction?"
The problem is that I don't know if you even have an update button. I had to assume you have some sort of handler to call update. It is also unclear, though the context seems to reveal it a bit, whether you are talking about updating a single record or many records at a time.
If I've missed your point, I apologize, I just think you should try to re-phrase it a bit to make it very clear what the problem is. You'll be a lot more likely to get a response that helps you fix the problem if you do.
Best Regards.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Sorry ! I typed that message in such a hurry that I could not re-read it even once. But yes what you have understood is correct. I have an update button and I want to update one row at a time when User clicks on Update. Is there a way in which you can get the foreign key in this case?
Another question I had is, when you have a table with composit primary key (3 columns in my case) and you have that as a foreign key in another table, how do you replace those (foreign key) composite columns by a combo box which will hold values for some other column from the primary key table ?
Thanks
- Rohit
|
|
|
|