I was getting the above error in one of my windows application. Was because of some section getting repeated in the app.config file.
Removing the duplicate section information from the app.config resolved the issue.
I was getting the above error in one of my windows application. Was because of some section getting repeated in the app.config file.
Removing the duplicate section information from the app.config resolved the issue.
First download the wsdl file for the lead record from Oracle CRM On Demand web application.
Add web references to it within a .NET windows application.
Use the following code for inserting the lead record.
We need to specify value for all the required field for the record to get inserted.
//Create the New lead record instandce And Set its url With proper session id
Lead myLead = New Lead();
myLead.Url = "https://secure-ausomxapa.crmondemand.com/Services/Integration;jsessionid=" + sessionID;
// create arrary Of lead record To be inserted
LeadData[] myLeadData = New LeadData[1];
myLeadData[0] = New LeadData();
myLeadData[0].LeadFirstName = "Nishant";
myLeadData[0].LeadLastName = "Rana";
myLeadData[0].Source = "Email";
myLeadData[0].dLead_Generation_Date = Convert.ToDateTime("7/30/2010");
myLeadData[0].LeadOwner = "Nishant Rana";
myLeadData[0].dLead_Generation_dateSpecified = True;
// add lead data array To listofLeadData Class
ListOfLeadData myLstLeadData = New ListOfLeadData();
myLstLeadData.Lead = myLeadData;
// create an instance Of leadinsert_input Class
LeadInsert_Input myLeadRecordInput = New LeadInsert_Input();
myLeadRecordInput.ListOfLead = myLstLeadData;
LeadInsert_Output myLeadRecordOutput = myLead.LeadInsert(myLeadRecordInput);
}
The sample code for the ManageSession.cs class
public static String Logoff(String logoffUrlString, string SessionID)
{
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(logoffUrlString);
// set the session id in header
req.Headers["JSESSIONID"] = SessionID;
// make the HTTP call
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
return resp.StatusCode.ToString();
}
}
Hope it helps !
Bye..
Within most of the organization, there is a default setting that after a few minutes have escaped, the system gets locked itself, if system is left unattended. Well to prevent this i have written a small utility (windows application) which periodically sends user input to the system, making it to believe that some mouse movement has been made and thus stopping the system from getting locked.
Here we would be calling SendInput function within user32.dll
The SendInput function synthesizes keystrokes, mouse motions, and button clicks and that is what we need.
http://msdn.microsoft.com/en-us/library/ms646310.aspx
This is useful in case we are giving presentation or else reading some documents …
Following is the code for the same
1) Create a new windows application in C#
2) Add a button named btn_Unlock to it and a timer control named timer1.
3) Set enabled to false and interval to 120000 for timer control.
4) Put the following code to your form class
public partial class frmKU : Form
{
public
frmKU()
{
InitializeComponent();
}
[DllImport("User32.dll", SetLastError = true)]
public static extern int SendInput(int
nInputs, ref INPUT
pInputs, int cbSize);
public struct INPUT
{
public
int type;
public
MOUSEINPUT mi;
}
public struct MOUSEINPUT
{
public
int dx;
public
int dy;
public
int mouseData;
public
int dwFlags;
public
int time;
public
int dwExtraInfo;
}
// Call the
API
int
resSendInput;
private
void btnUnlock_Click(object
sender, EventArgs e)
{
timer1.Enabled = true;
INPUT
input = new INPUT();
resSendInput = SendInput(5, ref input, Marshal.SizeOf(input));
}
private
void timer1_Tick(object
sender, EventArgs e)
{
INPUT
input = new INPUT();
resSendInput = SendInput(5, ref input, Marshal.SizeOf(input));
}
}
Bye …
I was facing the problem while trying to run one of my windows application created in Visual studio 2005 using .NET framework 2.0.
Few days back the application was running fine and today it on trying to run it i was getting the error.
The way it solved for me was to again open the project in solution explorer in visual studio and rebuilding it.
Bye,..
Create a new windows application project and add a button to it.
On click of that button, we will create a new document(word) and write a simple Hello World text in it.
To create a word document using C# we need to first reference the following DLL(com)

After adding reference, add this directive
using Microsoft.Office.Interop.Word;
Put this code on button click
private void button1_Click(object sender, EventArgs e)
{
object missing = System.Reflection.Missing.Value;
object Visible=true;
object start1 = 0;
object end1 = 0;
ApplicationClass WordApp = new ApplicationClass();
Document adoc = WordApp.Documents.Add(ref missing, ref missing, ref missing, ref missing);
Range rng = adoc.Range(ref start1, ref missing);
try
{
rng.Font.Name = “Georgia”;
rng.InsertAfter(“Hello World!”);
object filename = @”D:\MyWord.doc”;
adoc.SaveAs(ref filename, ref missing, ref missing, ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
WordApp.Visible = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
The easiest way to write code for office interoperability is to make use of VBA code.
Say you want to insert a picture in a word document what you can do is
open the word document – Go to Tools ->Macro-> Record New Macro
Now click on insert menu and insert the picture. Stop the recording, again go to Macro -Macros-> Select your Macro and click on edit
You will find the vba code over there
Sub Macro1()
Selection.InlineShapes.AddPicture FileName:= _
“C:\Documents and Settings\nishantr1\My Documents\My Pictures\untitled.bmp” _
, LinkToFile:=False, SaveWithDocument:=True
End Sub
Now to write the same code in c# you will do something like this
Range rngPic = adoc.Tables[1].Range;
rngPic.InlineShapes.AddPicture(@”C:\anne_hathaway.jpg”, ref missing, ref missing, ref missing);
Bye