|
Thanks for your reply but I can not understand how to use this. I am using given refrence link but it fires an exception (Update unable to find TableMapping['Table'] or DataTable 'Table'.).
|
|
|
|
|
It sounds like the basic issue is one of incompetence. Have you looked at the link provided and the code in the MSDN and compared it to your own ? If you want us to fix your code, have you considered posting it, so we can see where your error is ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
This is my code, where the problem occurs.
SqlDataAdapter da = new SqlDataAdapter("UPDATE CompanyInfo SET CompName='abc' where CompID='" + CompID.Text.Trim() + "'", con);
DataSet ds = new DataSet();
da.Fill(ds);
int gh = da.Update(ds, "CompanyInfo");
Exception fires on that code is ("Update unable to find TableMapping['CompanyInfo'] or DataTable 'CompanyInfo'.").
Please suggest for the wrong code.
Thanks and Regards
|
|
|
|
|
Hi every body,
Here i face a problem,the problem is i develop a pdf viewer,now i uninstall acrobat reader from my pc.
when i open a web page that contain pdf, open a new window with pdf viewer application. I want to open in IE like acrobat reader in IE.
Please help me.
using C#,.Net frame work 2.0
Sanjoy Bagchi
S/W Engineer
|
|
|
|
|
Sample.aspx:
Script File:
document.getElementById('ifr').src='LoadPdf.aspx';
In LoadPdf.aspx.CS .PageLoad Event U call This Method
private void WritePdf(byte[] pdfContent)
{
try
{
Response.ContentType = "application/pdf";
Response.OutputStream.Write(pdfContent, 0, (int)pdfContent.Length);
Response.Flush();
Response.Close();
}
catch (Exception ex)
{
throw ex;
}
}
|
|
|
|
|
Sir,in my pc there is no acrobat reader. there install my program to view pdf. i wrote your program but the error msg came like this
"
An invalid character was found in text content. Error processing resource 'http://localhost:1891/WebSite1/LoadPdf.aspx'. L...
%
"
please help me...
Sanjoy Bagchi
S/W Engineer
|
|
|
|
|
Hello everybody
I read the articles related to establish a connection between webcam and C#.
I have a webcam that has the following parameters
1-Image resolution RGB24 320*240....RGB24 1280*1024
I420 320*240...I420 640*480
I want to know how can i access these setting in my program.I want to change the mode and resolution
manually in my program
Regards
|
|
|
|
|
I had created a small application from the article http://www.codeproject.com/KB/cs/Attach_BHO_with_C_.aspx?fid=447248&df=90&mp p=25&noise=3&sort=Position&view=Quick&fr=51&select=2421069
But while the control is in "foreach loop", the CPU usage increases near about 80-90%. I just want to reduce that CPU usage.
The other thing is if I try to manipulate the web page text, the original text is visible to user for a fraction of second, and then the replaced text is visible to user. I don't want that original text is visible to user. I just want to replace the original text of a web page on the fly, for the I am using DWebBrowserEvents2_ProgressChangeEventHandler.
In the foreach loop I was identifying the tagname and replacing the innertext of tag element.
I want the replaced text should be seen directly by the user. But there was some delay in displaying the replaced text. i.e., initially for a fraction of second the original text is visible to user before the replaced text.
How can I avoid these two problems and the output should be...
1. User should be seen directly the replaced text but not the original text of a web page.
2. The CPU usage should be reduced which is caused because of "foreach loop".
As well as I was trying to identify individual tag elements using
http://www.codeproject.com/KB/shell/enum_selected_elements.aspx?
in which IMarkupServices interface is used. Here also same problem occurs. There is some delay in displaying the replaced text on the web page.
But the main problems are:
1. Delay in display of replaced text on a web page when it is visible to the user
2. The CPU usage is high which is caused because of "foreach loop".
I manipulated by innertext property of HTML tag elements in a foreach loop.
This has been developed from
http://www.codeproject.com/KB/cs/Attach_BHO_with_C_.aspx?fid=447248&df=90&mp p=25&noise=3&sort=Position&view=Quick&fr=51&select=2421069
How can i solve this.........
Any suggestions would have been appreciated.
I had spent so much time on these but are of no use.
I tried all these links but output is samea nd my problems can't be avoided.
http://social.msdn.microsoft.com/Forums/en-US/Offtopic/thread/1c835fad-66c0-46ba-b499-3ba7090bd660/
http://www.eggheadcafe.com/community/aspnet/2/10073309/how-to-reduce-cpu-usage-w.aspx
|
|
|
|
|
Hi ,
To reduce the CPU Usage in for each loop , you may use
Thread.Spleep(1) (you need to use System.Threading namespace), at the starting of you loop or at the end ,
Thread.Spleep(1) , will allow the CPU to serve the other threads.This should not impact your over all performance.
following is an example
A) Without Thread.Sleep(1) , the CPU usage is almost 70%
public Form1()
{
InitializeComponent();
while (true)
{
int i = 0;
i++;
i--;
}
}
B) If we use Thread.Sleep(1) , the CPU usage comes down to 2 %
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
while (true)
{
int i = 0;
i++;
i--;
Thread.Sleep(1);
}
}
}
Let me know if it was useful
-Regards
Bharat Jain
bharat.jain.nagpur@gmail.com
|
|
|
|
|
Bharat Jain wrote: To reduce the CPU Usage in for each loop
That doesn't really reduce CPU usage - you're actually running more code in B) than in A). It only gives lower priority threads a chance to run.
|
|
|
|
|
Agreed but using the Thread.Sleep(1) , shares the CPU with the other process , in a for each loop the CPU Usage is high because it continuously doing the same work and consuming most of the CPU , making it hard for other application to run properly , hence if share the CPU with other applications it makes system run right .
-Regards
Bharat Jain
bharat.jain.nagpur@gmail.com
|
|
|
|
|
I already tried this, but the CPU usage is same...
|
|
|
|
|
Friends,
Quite frequently i need to throw exception from the code. But i don't want to write my custom exception class. Reason is that i don't have any dynamic data to be associated. In such situation, currently i am doing something like this:
skyColor = GetSkyColor();
if(skyColor == Blue)
{
Console.WriteLine("Its a day");
}
else if(skyColor == Black)
{
Console.WriteLine("It is night");
}
else
{
msg = String.Format("{0} is not a valid sky color", skyColor.ToString() );
throw new Exception(msg);
}
As you can see above i am throwing "Exception" which is considered as bad practice. The second option is that i use InvalidOperationException, but this exception is used when object state is not valid which is not the case here. Third option is that i write my own exception class InvalidSkyColorException. The case i described above is well qualified for custom exception as i can associate dynamic data SkyColor. But issue is that in most of the cases i don't even have dynamic data to associate. I just want to throw a string message. Now if i start writing my custom exception class for each of the situation, then there will be thousands of such classes in the project.
So what you guys suggest me in such cases. Shall i continue to throw generic "Exception" or use InvalidOperationException ? Or is there better solution ?
Imtiaz
|
|
|
|
|
|
KSuthar wrote: custom exception class using ApplicationException class[
Don't derive from ApplicationException class. Derive it from Exception instead. See the remarks section here[^].
|
|
|
|
|
Imtiaz Murtaza wrote: So what you guys suggest me in such cases. Shall i continue to throw generic "Exception" or use InvalidOperationException ? Or is there better solution ?
Thumb rule, do not follow blindly: If the calling code needs to perform a special function on encountering this specific error situation, use a custom exception class. If you are simply logging the message, displaying a dialog to the user, etc, and the only thing that changes is the error message, use System.Exception.
Cheers,
Vıkram.
I've never ever worked anywhere where there has not been someone who given the choice I would not work with again. It's a job, you do your work, put up with the people you don't like, accept there are probably people there that don't like you a lot, and look forward to the weekends.
- Josh Gray.
|
|
|
|
|
Hi Imtiaz,
My suggestion would be , you can group up the types of exception in our applicaion and create a custom exception class for each group , for Example all the exception related to color can be grouped into an exception class called 'InValidColorChoiceExpection' than it does not matter if it is a sky color or any other exception related to color , you may not create a individual exception class for each exception, the point here to to properly Categorize the exceptions , in some case you may use the inbuilt .net Exception classes , for example if there is invalid Operation performed , you may not require to Create something like 'CustomInValidOpreation' , there is already an exception for it.
So in short, group you exception , try to fit it in a group that already exist , if not then only go for a new custom exception class.
I hope i am understandable
-Regards
Bharat Jain
bharat.jain.nagpur@gmail.com
|
|
|
|
|
hiii
In this Case u can use Exception()...
|
|
|
|
|
how can I join Transaction 1 and 2?
<br />
IDbTransaction oTran1 = oConn1.BeginTransaction();<br />
obj1 = new SomeObj(oConn1);<br />
obj1.DoWork();<br />
<br />
IDbTransaction oTran2 = oConn2.BeginTransaction(); <br />
obj2 = new SomeObj(oConn2);<br />
obj2.DoWork();<br />
<br />
oTran1.Commit();<br />
oTran2.Commit();<br />
I want to do something like:
<br />
oTran2.Join(oTran1);<br />
Thanks
dev
|
|
|
|
|
You want that both transactions to be in a single transaction scope? If yes, TransactionScope[^] class will help.
|
|
|
|
|
Many thanks - is this Microsoft SQL Server specific though?
dev
|
|
|
|
|
No it will work with all providers who supports transactions. I have used it with SQL server and Oracle. Using it with Oracle requires Microsoft transaction service for oracle to be installed.
|
|
|
|
|
i am new in programming, i want to know ,how is java, is it very difficult than c# & C++?what is her ranking..how much is it difficult?
, what is client side language & databases for java?
& what is her technology like asp.net for c# for web based ?
thanking you
|
|
|
|
|
|