|
Yes, I understood you the first time. I still don't know that it can be done, that is, I doubt you can tell a printer to flip the image, and I don't know of any way to flip what you're sending, unless you can put it onto a bitmap first, and then flip that.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
I have a large DataTable (67,000 records) and I need to perform an operation on just one column.
As an example, if I wanted to set all characters to upper case, I would consider using something like:
<br />
foreach (System.Data.DataRow row in myDataTable.Rows) <br />
{<br />
string lower = row[ColumnNumber].ToString();<br />
row[ColumnNumber] = lower.ToUpper();<br />
} <br />
Having tested the above code, it takes approx 60mins to update the entire data table on a 1.3ghz PC with 256mb ram.
Is there a more efficient method?
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
LearnVisualStudio.Net
|
|
|
|
|
Couple things:
Although I've never really tested it, I've heard anecdotally that foreach is not a very efficient way to do things. You can try for(int i=0;i < myDataTable.Rows.Count;i++) and then refering to myDataTable.Rows[i] inside of the loop.
More significantly: I think you should reconsider pulling 67000 rows into your client application. If you need to change that large a chunk of data, doing it in SQL on the database server will likely be faster.
Just my $0.02...Hope it helps,
Bill
|
|
|
|
|
Thanks for your reply. I'll give it a try.
Unfortunately I don't have much choice over pulling all that data in because it's been exported from a legacy system that used its own format for data storage.
Basically we've got to pull it in before we can push it into something else more usefull.
Weve developed this application because no SQL server or MS Access is available on the client PCs where data has to be manipulated.
Its a case of "If it takes an hour, it takes an hour" but it would be great to reduce this as much as possible.
I'm willing to try anything anyone can think of.
Regards
Wayne Phipps
____________
Time is the greatest teacher... unfortunately, it kills all of its students
LearnVisualStudio.Net
|
|
|
|
|
There are several things you could do. The DataTable is a damn heavy object which is relatively slow compared to other data structures. This is the price you pay for the complexity of the class. So your first thought should be about another datacontainer.
If you have relationships to other tables, a primary key set or active views on the datatable: Remove them, make your operation and readd. This way many checks while you update your data will be left out.
Also try to call BeginLoadData() and EndLoadData(). I dont know if it increses performance in updates (as it does while adding) but its worth a try.
|
|
|
|
|
Hello,
I wanna write a multithreaded application and I am in need of a feature which is known to me in MFC, but I am unaware of in .NET.
The problem is that I wanna spawn a worker thread from one of my forms. I can pass data to my worker thread from my dialog, but it is not enough to me, I also have to manipulate the UI controls of the caller from my worker thread. In MFC one can pass a pointer of the caller dialog to one's worker thread, which does the job.
I am sure, there must be a similar thing in .NET too.
Please help!
Thanks in advance.
Peter Molnar
|
|
|
|
|
|
Control has an Invoke method that should be used when you need to update a control from a thread other than the one that created it. Use InvokeRequired to determine whether it is necessary to use Invoke .
Charlie
if(!curlies){ return; }
|
|
|
|
|
I tried to insert a record to database(in user register operation) using Access 2003 database and an exception appears("this operation must use updateable queries.").But when i use the same code with SQL2000 Database,every thing is OK.
Anyone can explain for me,and how to insert a record to Access database ? thanks.
the full code:
/////////////////////////////////////////////////
bool result = false;
//OLEDB
OleDbConnection dbConnection = new System.Data.OleDb.OleDbConnection(CfgKeyOleConnString+CfgKeyOleDatabase);
string strSQL = "INSERT INTO Users (UserName,Name,UserPassword,Email,RoleID) VALUES (@UserName,@Name,@UserPassword,@Email,@RoleID)";
OleDbCommand dbComm = new OleDbCommand(strSQL,dbConnection);
dbComm.Parameters.Add(new OleDbParameter ("@UserName", OleDbType.VarChar, 50));
dbComm.Parameters["@UserName"].Value = userName;
dbComm.Parameters.Add(new OleDbParameter ("@Name", OleDbType.VarChar, 50));
dbComm.Parameters["@Name"].Value = displayName;
dbComm.Parameters.Add(new OleDbParameter ("@UserPassword", OleDbType.VarChar, 50));
dbComm.Parameters["@UserPassword"].Value = userPassword;
dbComm.Parameters.Add(new OleDbParameter ("@Email", OleDbType.VarChar, 50));
dbComm.Parameters["@Email"].Value = userEmail;
dbComm.Parameters.Add(new OleDbParameter ("@RoleID", OleDbType.Numeric , 8));
dbComm.Parameters["@RoleID"].Value = Convert.ToInt32(Role);
try
{
dbConnection.Open();
dbComm.ExecuteNonQuery();
result = true;
}
catch(Exception ex)
{
Console.WriteLine(ex.ToString());
result = false;
}
finally
{
if (dbConnection.State==ConnectionState.Open)
dbConnection.Close();
}
return result;
...NLD...
|
|
|
|
|
The OleDb data provider does not use named parameters. Instead, it uses question marks as placeholders.
string strSQL = "INSERT INTO Users (UserName,Name,UserPassword,Email,RoleID) VALUES (?, ?, ?, ?, ?)";
Obviously, you need to make sure your parameters are added in the correct order.
Charlie
if(!curlies){ return; }
|
|
|
|
|
Anybody familiar with how to set Socket Options, specifically DontFragment?
I've tried the following lines and get the following error messages:
<br />
Socket s = new Socket(IPEP.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp);<br />
s.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.DontFragment, true);<br />
Error: optionValue
<br />
Socket s = new Socket(IPEP.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp);<br />
s.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.DontFragment, 1);<br />
Error: An unknown, invalid, or unsupported option or level was specified in a getsockopt or setsockopt call
I haven't been able to google any working examples, and MSDN is suprisingly general.
Thanks for your help!
|
|
|
|
|
I had the same fun trying to stop one of the base web services classes from sending a fragmented POST to the server... I found no resolution I didnt get any errors though, but from viewing packet captures i could see no matter what, it still was fragmented...
top secret Download xacc-ide 0.0.3 now! See some screenshots
|
|
|
|
|
It's fairly gratifying to know that my programming skills are maturing to the point that I'm asking questions people don't know the answer to.
|
|
|
|
|
I’ve implemented a GUI for a tabletop device using C# and the .NET framework 1.1. At the moment, my interface consists of a collection of virtual sheets of paper in which you can draw. Those documents can be rotated and moved. For the first prototype, I implemented all the graphics by myself in the code. But now I have to reengineer this system in order to add functions. I’m planning to use the standard components, like buttons, textbox, panels, etc. Then, as the second step, I will use activeX, video players, PowerPoint documents, Excel documents etc. Of course, all those things should rotate as well.
So, the question is: Can I extend components, or forms (or generic Windows components...), in order to rotate them? As to as I now, it seems to be impossible to change the orientation of a Component’s ClipRectangle in C#, even if it’s only possible to rotate their graphic interface.
Are there some MS developers who can help me?
Here is the video of the first prototype:
CHILpromo_small.avi
|
|
|
|
|
You can rotate a graphics device using Graphics.Transform, then draw as you usually would, resulting in a transformed image.
using System.Drawing;
using System.Drawing.Drawing2d;
...
Matrix m = new Matrix();
m.Rotate(90);
graphicsSurface.Transform = m;
Any remotely useful information on my blog will be removed immediately. There are 10 kinds of people in the world. Those who have heard of the ubiquitous, overused, worn-out-like-an-old-shoe binary "joke" and those who haven't.
Judah Himango
|
|
|
|
|
to rotate only graphics is not enough. The client rectangle doesn't change, so the Hit-testing algorhythm is wrong.
|
|
|
|
|
|
I normally don't make post like this but PLEASE search before you ask a question. If you would have simply typed "datagrid checkbox" without the quotes into the CP search box you would have found your answer in a few seconds.
Besides The Code Project[^] another good link is http://www.datagridgirl.com[^]
-Richard
|
|
|
|
|
Sorry i meant to ask if i can do this using windows forms not asp .net
|
|
|
|
|
DataGridBoolColumn
CP and Google are your best friend...
|
|
|
|
|
Hi all,
I am living in the UK, using UK time format dd/mm/yyyy, both in the program and the database (MSAccess), but when I use the the comand text such as:
"SELECT ... WHERE(TheDate BETWEEN #"+startdate+"# AND #"+enddate+"#)"
the sql engin get confused between day and month fields and gives wrong result.
Is there any way to set the time format as a default to the UK format?
Thanks,
|
|
|
|
|
Use parameters instead:
"SELECT ... WHERE(TheDate BETWEEN ? AND ?)"
comm.Parameters.Add("startDate",OleDbType.Date);
comm.Parameters.Add("endDate",OleDbType.Date);
comm.Parameters[0].Value=startdate;
comm.Parameters[1].Value=enddate;
|
|
|
|
|
I know this is a RTFM kind of question, but I can't find the answer in the FM.
I have a C# project that uses libraries from an external application.
The instructions I have read:
you will need to change your project settings to include the following folders:
include paths:
[drive]:\Program Files\Blah\Blah\SDK\Include
executable paths:
[drive]:\Program Files\Blah\Blah\Bin
How do I do that?
Thanks.
|
|
|
|
|
Hi )
I'm making a small pocket pc application, and would like it to access the Contact Database.
I have searched the net for days but can't find out how.
I don't know if it's a sqlce database.
Any help would be appreciated.
Steen
|
|
|
|
|
Hi,
I've put a datagrid in a tabPage. As in most cases the number of collumns exceed the width of the screen.
How can I make a scrollbar appear in this case ? (so horizontal,vertical)
More info. The tabControl holding the tabpage is put in an Panel.
Thanks in advance
|
|
|
|
|