|
Ilango Gandhi wrote: What are the possibilities for the following error ' Exception has been thrown by the target of an invocation ' in C#.net
Almost anything. It means that you have called a method using Invoke , and during the execution of that method an exception occured.
Examine the InnerException property of the exception that you got. That will contain the exception that occured in the call.
---
single minded; short sighted; long gone;
|
|
|
|
|
You also get this error when an exception occurs in a Background Worker
|
|
|
|
|
Hi All,
Iam using 3 tier architecture.Now what iam doing is i written database related things into DAL.Now i want to access these class and methods into
BLL.After that iam accessing BLL classes into my GUI.But here it is showing this error
Type Load Exception Was Unhandled by User Code
Could not load type 'DAL.JoDetailsDAL' from assembly 'DAL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Here is My DAL Code file
JoDetailsDAL.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Data.SqlClient;
namespace DAL
{
public class JoDetailsDAL
{
CommonDAL objCommonDAL = new CommonDAL();
public SqlDataReader getcustomer(ref string errorMsg)
{
string strSelect = "select CustomerName from cm_tb_032";
return objCommonDAL.getDataReader(strSelect, ref errorMsg);
}
public SqlDataReader getvendor(ref string errorMsg)
{
string strSelect = "select VendorName from cm_tb_033";
return objCommonDAL.getDataReader(strSelect, ref errorMsg);
}
public SqlDataReader getvendorcity(ref string errorMsg)
{
string strSelect = "select VendorCity from cm_tb_034";
return objCommonDAL.getDataReader(strSelect, ref errorMsg);
}
public SqlDataReader getvendorstate(ref string errorMsg)
{
string strSelect = "select VendorState from cm_tb_035";
return objCommonDAL.getDataReader(strSelect, ref errorMsg);
}
public SqlDataReader getjostatus(ref string errorMsg)
{
string strSelect = "select Status from cm_tb_036";
return objCommonDAL.getDataReader(strSelect, ref errorMsg);
}
public SqlDataReader getamendmentstatus(ref string errorMsg)
{
string strSelect = "select AmendmentStatus from cm_tb_038";
return objCommonDAL.getDataReader(strSelect, ref errorMsg);
}
public SqlDataReader getdeliveryschedule(ref string errorMsg)
{
string strSelect = "select DelSchedule from cm_tb_039";
return objCommonDAL.getDataReader(strSelect, ref errorMsg);
}
public SqlDataReader termsofpayment(ref string errorMsg)
{
string strSelect = "select TermsOfPayment from cm_tb_040";
return objCommonDAL.getDataReader(strSelect, ref errorMsg);
}
}
}
Here is My BLL Code
using System;
using System.Collections.Generic;
using System.Text;
using System.Data.Sql;
using System.Data.SqlClient;
using DAL;
namespace BLL
{
public class JoDetailsBLL
{
JoDetailsDAL objJoDetailsDAL = new JoDetailsDAL();
public SqlDataReader getcustomer(ref string errorMsg)
{
return objJoDetailsDAL.getcustomer(ref errorMsg);
}
public SqlDataReader getvendor(ref string errorMsg)
{
return objJoDetailsDAL.getvendor(ref errorMsg);
}
public SqlDataReader getvendorcity(ref string errorMsg)
{
return objJoDetailsDAL.getvendorstate(ref errorMsg);
}
public SqlDataReader getvendorstate(ref string errorMsg)
{
return objJoDetailsDAL.getvendorstate(ref errorMsg);
}
public SqlDataReader getjostatus(ref string errorMsg)
{
return objJoDetailsDAL.getjostatus(ref errorMsg);
}
public SqlDataReader getamendmentstatus(ref string errorMsg)
{
return objJoDetailsDAL.getamendmentstatus(ref errorMsg);
}
public SqlDataReader getdeliveryschedule(ref string errorMsg)
{
return objJoDetailsDAL.getdeliveryschedule(ref errorMsg);
}
public SqlDataReader termsofpayment(ref string errorMsg)
{
return objJoDetailsDAL.termsofpayment(ref errorMsg);
}
}
}
Here is my GUI Code file
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Reflection;
using BLL;
public partial class JoDetails : System.Web.UI.Page
{
JoDetailsBLL objJoDetailsBLL = new JoDetailsBLL();
string errorMsg = null;
protected void Page_Load(object sender, EventArgs e)
{
getcustomer();
getvendor();
getvendorcity();
getvendorstate();
vendorinvoicecity();
vendorinvoicestate();
jopartcity();
joshipcity();
joshipstate();
jostatus();
joamendmentstatus();
getdeliveryschedule();
termsofpayment();
}
public void getcustomer()
{
SqlDataReader dr = objJoDetailsBLL.getcustomer(ref errorMsg);
if (dr == null)
{
errorLbl.Text = errorMsg;
errorLbl.Visible = true;
}
else
{
JoCustomerLst.DataSource = dr;
JoCustomerLst.DataTextField = "cust_name";
JoCustomerLst.DataBind();
}
}
public void getvendor()
{
SqlDataReader dr = objJoDetailsBLL.getvendor(ref errorMsg);
if (dr == null)
{
errorLbl.Text = errorMsg;
errorLbl.Visible = true;
}
else
{
JoVendorLst.DataSource = dr;
JoVendorLst.DataTextField = "vendor_name";
JoVendorLst.DataBind();
}
}
public void getvendorcity()
{
SqlDataReader dr = objJoDetailsBLL.getvendorcity(ref errorMsg);
if (dr == null)
{
errorLbl.Text = errorMsg;
errorLbl.Visible = true;
}
else
{
JoVendorCityLst.DataSource = dr;
JoVendorCityLst.DataTextField = "vendor_city";
JoVendorCityLst.DataBind();
}
}
public void getvendorstate()
{
SqlDataReader dr = objJoDetailsBLL.getvendorstate(ref errorMsg);
if (dr == null)
{
errorLbl.Text = errorMsg;
errorLbl.Visible = true;
}
else
{
JoVendorStateLst.DataSource = dr;
JoVendorStateLst.DataTextField = "vendor_state";
JoVendorStateLst.DataBind();
}
}
public void vendorinvoicecity()
{
SqlDataReader dr = objJoDetailsBLL.getvendorcity(ref errorMsg);
if (dr == null)
{
errorLbl.Text = errorMsg;
errorLbl.Visible = true;
}
else
{
JoInvoiceToCityLst.DataSource = dr;
JoInvoiceToCityLst.DataTextField = "vendorinvoice_city";
JoInvoiceToCityLst.DataBind();
}
}
public void vendorinvoicestate()
{
SqlDataReader dr = objJoDetailsBLL.getvendorstate(ref errorMsg);
if (dr == null)
{
errorLbl.Text = errorMsg;
errorLbl.Visible = true;
}
else
{
JoInvoiceToStateLst.DataSource = dr;
JoInvoiceToStateLst.DataTextField = "vendorinvoice_state";
JoInvoiceToStateLst.DataBind();
}
}
public void jopartcity()
{
SqlDataReader dr = objJoDetailsBLL.getvendorcity(ref errorMsg);
if (dr == null)
{
errorLbl.Text = errorMsg;
errorLbl.Visible = true;
}
else
{
JoParCityLst.DataSource = dr;
JoParCityLst.DataTextField = "jopart_city";
JoParCityLst.DataBind();
}
}
public void joshipcity()
{
SqlDataReader dr = objJoDetailsBLL.getvendorcity(ref errorMsg);
if (dr == null)
{
errorLbl.Text = errorMsg;
errorLbl.Visible = true;
}
else
{
JoShipToCityLst.DataSource = dr;
JoShipToCityLst.DataTextField = "joship_city";
JoShipToCityLst.DataBind();
}
}
public void joshipstate()
{
SqlDataReader dr = objJoDetailsBLL.getvendorstate(ref errorMsg);
if (dr == null)
{
errorLbl.Text = errorMsg;
errorLbl.Visible = true;
}
else
{
JoShipToStateLst.DataSource = dr;
JoShipToStateLst.DataTextField = "joship_state";
JoShipToStateLst.DataBind();
}
}
public void jostatus()
{
SqlDataReader dr = objJoDetailsBLL.getjostatus(ref errorMsg);
if (dr == null)
{
errorLbl.Text = errorMsg;
errorLbl.Visible = true;
}
else
{
JoStatusLst.DataSource = dr;
JoStatusLst.DataTextField = "joship_status";
JoStatusLst.DataBind();
}
}
public void joamendmentstatus()
{
SqlDataReader dr = objJoDetailsBLL.getamendmentstatus(ref errorMsg);
if (dr == null)
{
errorLbl.Text = errorMsg;
errorLbl.Visible = true;
}
else
{
JoAmendStatusLst.DataSource = dr;
JoAmendStatusLst.DataTextField = "amendment_status";
JoAmendStatusLst.DataBind();
}
}
public void getdeliveryschedule()
{
SqlDataReader dr = objJoDetailsBLL.getdeliveryschedule(ref errorMsg);
if (dr == null)
{
errorLbl.Text = errorMsg;
errorLbl.Visible = true;
}
else
{
JoDeliveryLst.DataSource = dr;
JoDeliveryLst.DataTextField = "delivery_schedule";
JoDeliveryLst.DataBind();
}
}
public void termsofpayment()
{
SqlDataReader dr = objJoDetailsBLL.termsofpayment(ref errorMsg);
if (dr == null)
{
errorLbl.Text = errorMsg;
errorLbl.Visible = true;
}
else
{
JoTermsOfPayLst.DataSource = dr;
JoTermsOfPayLst.DataTextField = "terms_payment";
JoTermsOfPayLst.DataBind();
}
}
}
Please help on this .
veeresh
|
|
|
|
|
Hii This is kumar recently i saw the application in code project regarding getting the files from the remote server in the below URL
http://www.codeproject.com/dotnet/FTPWinFormClient.asp
here i am getting the error as
A socket program was attempted to an unreachable host
i am getting this error in the drawDirectoryContents() method in the code .
can any one please help me in this ontest and mail me to my id if possible plsssss
santu412@gmail.com,
regards,
kumar
|
|
|
|
|
1 - try using meaningful subject lines
2 - don't give your email address on the site
3 - the forum that appears under the article is there for you to ask the author questions.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
:: Try to write a subject line that says anything about the subject of the thread.
:: However urgent you may think it is, it's never so urgent that it's worth mentioning in the subject line, or you wouldn't have posted the question in a forum instead of paying for assistance.
:: Don't ask for replies to your mailbox. Replies goes to the forum, where everyone can benefit.
santu_kumar wrote: here i am getting the error as
A socket program was attempted to an unreachable host
i am getting this error in the drawDirectoryContents() method in the code .
What ftp site have you specified as host? Have you checked that you can reach the ftp at all from your computer?
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi Buddies,
I think this quest will confus you. Wht i wanna to do is tht, I have develop 1 application in C# which can programaticallygenerating one Class file(say class1.cs) in C:\.
class1.cs will contain one method which include nos. of exe path which would be invoke one by one after calling this method.
In clicking on button I have to compile this file(class1.cs) automatically. If there is any error, redirect it to one text file else create one instant of class1.cs and then call the method.
Problem is
"how to create whole C# project programatically" and
"how to compile this .cs file programatically".
Help wud b appreciated.
Regards
Chintan
www.visharadsoft.com
(I am thinking to change humans to computer, but unfortunately GOD will not give me the source code)
|
|
|
|
|
Chintan.Desai wrote: "how to create whole C# project programatically"
I don't think that you can create whole C# project programatically. But you can create a C# file ( cs ) since it is a normal text file. Use FileStream to create the file.
Chintan.Desai wrote: "how to compile this .cs file programatically".
Are you familiar with compiling C# file from command file. ? If yes you can write a bat file which contains these commands and execute the bat file. But regarding Identifying error and coming back to C# file, I don't have much idea.
|
|
|
|
|
Chintan.Desai wrote: how to compile this .cs file programatically
You can do it using CSharpCodeProvider class. This article describes how to do it: Mp3ToExe[^]
|
|
|
|
|
thanxs,u have solve my quest. Even, I have completed my module this evening.
thanx again
bye
Regards
Chintan
www.visharadsoft.com
(I am thinking to change humans to computer, but unfortunately GOD will not give me the source code)
|
|
|
|
|
Hi all
I posted this question yesterday also and no one replied me. I think no one is willing to help me or angry with me......
I want to read a particular node of xml file. For that i am using the code
XmlTextReader reader = new XmlTextReader ("tx1.xml");
while (reader.Read ())
{
if(reader.IsStartElement ())
{
if (reader.NodeType == XmlNodeType.Element && reader.Name == "jid")
{
str=reader.ReadString();
Lblmsg.Visible=true;
Lblmsg.Text="journal ID <"+ reader.Name+ "> is : "+str;
reader.Read();
break;
}
break;
}
}
but here the problem is it is trying to validate the xml file using the DTD. I dont want to validate it using dtd. Plz help to solve this. what i have to use here. Plz help me thank u
|
|
|
|
|
Why are you using an XmlReader? You could load the document into an XmlDocument object and then use XPath queries and SelectSingleNode or SelectNodes calls to get the node you are interested in.
|
|
|
|
|
Scott is absolutely correct.
XPath is fastest among all in parsing xml node.
Regards
Chintan
www.visharadsoft.com
(Nothing is so purify as KNOWLEDGE)
|
|
|
|
|
Chintan.Desai wrote: Scott is absolutely correct.
XPath is fastest among all in parsing xml node.
YES he is. But if the XML file is pretty huge, then this method may take some time. I think XMLDocument class loads the entire XML file to the memory when it initializes. Am I right ?
|
|
|
|
|
Yes, you are correct. The XmlDocument class does read the entire file into memory. In my opinion, if you're trying to deal with XML files that large, you should probably be using something other than XML.
|
|
|
|
|
ya, u r correct? but buddy loading xml and parsing both are completely different. Its work of different object. Its just lik this Building apartement is made by engineer, but its maintainance is depend on people who live ther.
So, XPath is very fastest in parsing.
Bye
Regards
Chintan
www.visharadsoft.com
(I am thinking to change humans to computer, but unfortunately GOD will not give me the source code)
|
|
|
|
|
I want to read a huge xml file and the node that i want to read is about to the middle of the file. Then also XPath is of to use?
|
|
|
|
|
P_Elza wrote: I want to read a huge xml file and the node that i want to read is about to the middle of the file. Then also XPath is of to use?
Why don't you write an application that compares performance difference for both the methods. I feel loading huge XML file to XMlDocument class will be slow compared to other.
|
|
|
|
|
Yes, XPath would be of use. XPath is the "query" language that allows you to retrieve a specific node or list of nodes. Think of it as working in a similar way to a SQL Select statement for a database.
|
|
|
|
|
What is the size of your xml file ? if its 1 GB like that then you hsould use xmlreader and dom in hand like this
http://www.codeproject.com/useritems/XmlParsing.asp[^]
Thanks and Regards
Sandeep
If If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
You may want to take a look at vtd-xml for that...
http://vtd-xml.sf.net
|
|
|
|
|
Graphical problems really, functionality is fine.
Due to the slightly odd shape of the form, when you minimize / restore the form the blue (silver/green) bar reapears and looks kinda lame (WinXP). On minimizing i can just hide the form, minimize it, then show it again. But that code is in my little minimize button. When restoring i can't control what happens, so any ideas there would be great.
A more serious problem, when loading (initially and when restoring the window) everything appears, then all controls / graphics dissapear leaving a black shape, then all reappear. All withing a fraction of a second of course, i need to find out how to hide the form until everything has been (re)loaded then show it again. Also when the form first loads and it flickers, you just see garbage from the vram instead of the background image of the form, just for a fraction of a second of course.
Ugh anyway...
perhaps if you could have some kind of double buffering. I know c# has an option for that somewhere, but i don't know what it affects or how to use it. Argh, this is doing my head in.
-- modified at 23:32 Thursday 20th September, 2007
Eew, temporary fix. On form load, set opacity to 0.
In the on paint event count up the number of controls draw (14 need to be drawn, so each time the paint event is fired by each control a counter is increased) once the counter reaches the required number the opcaity is set back to 1.0.
When you minimize the counter is reset.
It wouldn't be so bad, but not all controls set off the paint event, so i coulnd't compare the counter to this.Controls.Count
|
|
|
|
|
I think this might fix your problem if your form is extended from the System.Windows.Forms.Form class. Enter the following code into the constructor of your form.
<br />
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);<br />
I hope it fixes your problem, if it doesn't maybe someone else knows how to fix it.
|
|
|
|
|
While recording the application, using Web test, the test is not recording the Cookie actions in certain stage, how could i record the Cookie actions in that application? or how could i add the code to the webtest source code?
|
|
|
|
|
After adding pictureboxes to my form which move using the keydown event and drawing using gdi+,i decided to put a defined usercontrol on my form.the pictureboxes don't move,and nothing is drawn.then i thought the problem is in the usercontrol so i removed it and i put a button.the same happend wht should i do?
|
|
|
|