|
The existing instance is created in another app. My own app want to control the existing instance.
This other app is a "off-the-shelf" software.
|
|
|
|
|
Then you're very limited in what you can do.
If the COM object that app creates is a singleton AND is exposed to the rest of the system, then you can probably use the Activator.GetObject() method to get at the instance of the COM object (you still need to import the COM object in your project references.) If not, you're pretty much SOL.
|
|
|
|
|
I received the following error (see line *********error***********) when trying to transfer data from excel to sql using the code below. The sql table is in the database and columns all match the store procedure, does anyone have any idea what creates this problem.
Thanks in advance, Michael
Failed to obtain column collation information for the destination table. If the table is not in the current database the name must be qualified using the database name (e.g. [mydb]..[mytable](e.g. [mydb]..[mytable]); this also applies to temporary-tables (e.g. #mytable would be specified as tempdb..#mytable).
void ExcelToSqlBulkCopy(String strPath, String strFile, String strTableName)
{
strExcelStoredProcedure = "SELECT ID,City,State FROM [Cities$]";
String excelConnectionString = y;
String sqlConnectionString = z;
// Create Connection to Excel Workbook
using (OleDbConnection connection = new OleDbConnection(excelConnectionString))
{
OleDbCommand command = new OleDbCommand(strExcelStoredProcedure, connection);
connection.Open();
// Create DbDataReader to Data Worksheet
using (DbDataReader dr = command.ExecuteReader())
{
// Bulk Copy to SQL Server
using (SqlBulkCopy bulkCopy = new SqlBulkCopy(sqlConnectionString))
{
bulkCopy.DestinationTableName = "[MyDatabase].[dbo].[" + strTableName + "]";
bulkCopy.WriteToServer(dr); *********error***********
}
}
connection.Close();
}
}
|
|
|
|
|
I never use a data reader so how do you inspect the contents of a datareader to check that the info in it is correct before you try to bulk copy.
I would change the datareader to a datatable and inspect the contents before the bulkcopy statement comparing the columns and the datatypes, excel is a crappy data source! Collation makes me suspect unicode or suspect characters in the data.Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
I am into a 3D simulation project where I need to subtract a 3D model from another (repeatedly fast). I am using OpenGL and STL-files. Can anyone give me a suggestion of what to use? My dream is to find something that I could use call from C#. Or maybe can help me code it? I am a student so I cant afford to buy anything fancy, so if there is anything free I would love to hear about it.
|
|
|
|
|
I'm not sure what you mean by "subtract a 3D model from another (repeatedly fast)", but XNA is pretty much the standard for doing 3D type work with C# (usually relating to video games).
|
|
|
|
|
Thanks. It is for a machine simulator where I need to run a mill (a cylinder with flat or ball edge at the bottom) through a workpiece. Each time the mill moves it needs to erase the material that it touches, making a track in the material. So I more or less need to say subtract(myWorkPiece, myMill). That is called 3D boolean operations, do you know if XNA can do that?
|
|
|
|
|
That is more like a feature you'd find in a fully functional 3D design program, not in XNA. You'd have to build that feature yourself, but XNA could help I'm sure.
|
|
|
|
|
This is not a simple problem. There are some open-source packages for doing solid modeling, but they require a lot of work and you will have to link to these non-managed code libraries (written in C, not dot-net) in order to use them in C#. The most well known is http://www.opencascade.org/ but there are others. Search for "solid modeling" and "free library" or "open source" to find them. I wish you a lot of luck.
|
|
|
|
|
Thank you! I suspected it was going to be hard, I dont even dare to think of figuring out myself. I will check out your suggestions, still hoping I will be able to find a solution.
|
|
|
|
|
Hi,
Below is the code to create a 3 x 3 matrix with the vector (A system of linear equstions)
2x+ y -z = 8
-3x -3y +2z = -11
-2x +y + 2z = -3
The method works fine and displays the solution. Instead of typing in the numbers for the 3 x 3 matrix I would like to create a method for an arbitrary n x n matrix with data in an excel file. For example I would like to do the operations on a file that is 50 x 50 in an excel file. ( iguess I could type in all 2500 values but that would be stupid even for a C# newbie. What would be the code to perform such an operation?
static void TestGaussJordan()
{
LinearSystem ls = new LinearSystem();
MatrixR A = new MatrixR(new double[3, 3] { { 2, 1, -1 }, { -3, -1, 2 }, { -2, 1, 2 } });
Console.WriteLine(" Matrix is \n " + A);
VectorR b = new VectorR(new double[3] { 8, -11, -3 });
Console.WriteLine(" Vector b is \n " + b);
VectorR x = ls.GaussJordan(A, b);
Console.WriteLine("Solution x=\n" + x)
|
|
|
|
|
It would go something like this:
double[,] FillMatrix(int wide, int tall)
{
double[,] matrix = new double[wide, tall];
for(int x = 0; x < wide; x++)
{
for(int y = 0; y < tall; y++)
{
matrix[x, y] = GetValue(x, y);
}
}
return matrix;
}
double GetValue(int x, int y)
{
}
If it must come from an Excel file, I can't help you as I don't know much about that. However, you could export it to a CSV format and then parse that text file if that is an option.
|
|
|
|
|
|
By the way, I just noticed that your title doesn't relate to your question at all.
|
|
|
|
|
Hello
I was trying to use a Clip to define the drawing area on a graphic
Let says that I'm woking with a Graphics on a page : bound 0,0,1200,1800
I define a clip at 100,100,700,900
So the clipBound is 100,100,700,900
I was expecting that if I draw something at 0,0 on that graphics it will be 0,0 on my clip so 100,100 on my page
But it remain 0,0 on the page
So my question is : What is the use of a clip ? Is it really usefull for some purpose ?
Thank for your help
|
|
|
|
|
Ummm, according to the documentation a Clip "gets or sets a Region that limits the drawing region of this Graphics."
Why would you think it translates coordinates?CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
Thanks for you reply Walt
"gets or sets a Region that limits the drawing region of this Graphics."
Let's assume that
So how that limit works ?
If I set a clip as
Graphics.Clip(new Region(new Rectangle(100,100,500,800));
The limited region will be 100,100,500,800
So at least if the coordinates are not translated, drawing at 0, 0 is outside the clip and I will see nothing
But is seems that I can continue to draw anywhere on the original graphics
|
|
|
|
|
You are supposed to be able to use any valid coordinate, but only the ones inside the clip bounds would be drawn on the graphic surface. Opacity, the new Transparency.
|
|
|
|
|
You are supposed to be able to use any valid coordinate, but only the ones inside the clip bounds would be drawn on the graphic surface.
That was not the result I got
I will try again... Maybe the fact that I was using a TransFormMatrix on the Graphics affects the normal behaviour
|
|
|
|
|
|
As you mentioned in another post, perhaps the transformation is affecting the way it appears to work
Indeed !
Thank you Walt
|
|
|
|
|
at to fast message sending i get 1 incoming message with 10 grouped packets and not 1 packet for each of 10 incoming messages
for
p.s. sry for terrible english
|
|
|
|
|
I am not sure what the 1 message with 10 packets means... specially compared to 1 packet to 10 messages, but I think I have the "solution".
For example:
Send("Test1");
Send("Test2");
Send("Test3");
The client can receive:
Test1Test2Test3
Or you can receive the message as:
Test
1Tes
t2Te
st3
In fact, TCP/IP only "streams" data. If you expect to send "one packet" and receive "one packet" you are going the wrong way.
Ahh... and that's has nothing to do with synchronous or asynchronous programming... it's the TCP/IP way of working.
If you expect for messages, you must Receive the buffer, accumulate it to the last buffer (if it exists) and then search as many "begin/ends" as it is possible in the message, so it's up to you to do that.
|
|
|
|
|
|
I know that LINQ, Entity Model and RIA Services (when it is available) are great and all, but I find that all the extrapolation makes me stupid and makes it harder to solve problems. I know it takes a few extra hours to write your own classes that represent your database objects, but I like the having the extra control.
One of the things that kills me about ASP.Net MVC is that MS tells us one of the benefits is the granular control over the HTML. Well, I kind of like having the granular control over my database transactions. I also find that it is an important skill in the business world to be good at writing SQL. Being able to easily adhoc query your databases is also very important. I know it is a bit of extra work, but frankly I prefer to program that way.
Anyone else agree with me?
I didn't get any requirements for the signature
|
|
|
|