 |
 |
Index ‹ DotNet ‹ Net Framework
|
- Previous
- 1
- 2
- 3
- Visual C#.Net >> Displaying field value in datarowI'm trying to display a field from a datarow like this:
DataRow[] myRow = DS_Urb.Tables["Urb"].Select("Code = 'MyCode'"); // it
returns at least one row
MessageBox.Show (myRow[0].ToString(), urb);
But I get "System.Data.DataRow". How can I display field "Name" ?
- 4
- ADO >> DataSet Binding QuestionHi,
I am having problems with binding a dataset to a combo box. I have created
an query in Access 2002 called procModels. I want to be able to call it and
retrieve the data from the query. I have included some code below. Any
help will be appreciated.
sql = "EXECUTE procModels";
OleDbConnection dbConn = new OleDbConnection(connString);
OleDbDataAdapter dbAdapter = new OleDbDataAdapter(sql, dbConn);
DataSet ds = new DataSet();
dbAdapter.Fill(ds, "tblModels");
return ds;
databinding code:
this.modelComboBox.DataSource = ds.Tables["tblModels"];
Thanks in adavance
this.modelComboBox.DisplayMember = "tblModels.strCode";
- 5
- Net Framework >> Error while sending e-mails with attachments using SmtpClient::SendAsyncError while sending e-mails with attachments using
SmtpClient::SendAsync Options
There are currently too many topics in this group that display
first. To make this topic appear first, remove this option from
another topic.
There was an error processing your request. Please try again.
Standard view View as tree
Proportional text Fixed text
1 message - Collapse all
The group you are posting to is a Usenet group. Messages posted to
this group will make your email address visible to anyone on the
Internet.
Your reply message has not been sent.
Your post was successful
mukesh bhakta View profile
More options May 14, 10:46 am
Newsgroups: microsoft.public.dotnet.framework.windowsforms
From: mukesh bhakta <mukesh_bha...@hotmail.com>
Date: 13 May 2007 17:46:04 -0700
Local: Mon, May 14 2007 10:46 am
Subject: Error while sending e-mails with attachments using
SmtpClient::SendAsync
Reply | Reply to author | Forward | Print | Individual message | Show
original | Remove | Report this message | Find messages by this
author
Hi guys,
I get an error when I send e-mails with attachments using SmtpClient.
Following is the code snippet -
MailMessage msg = new MailMessage(from, to);
/*...all the initialization goes here */
byte [] data = /* some binary data */
using (MemoryStream ms = new MemoryStream(/*att.Contents*/))
{
using (StreamWriter sw = new StreamWriter(ms))
{
sw.Write(data);
sw.Flush();
ms.Position = 0;
System.Net.Mail.Attachment natt = new
System.Net.Mail.Attachment(
ms, "test.txt");
msg.Attachments.Add(natt);
}
}
private static void sendCompletedCallback(object sender,
AsyncCompletedEventArgs e)
{
if (e.Cancelled)
{
logmsg("E-mail send cancelled");
}
else if (e.Error != null)
{
System.Diagnostics.Debug.WriteLine(e.Error.ToString());
logmsg(e.Error.Message + ' ' +
e.Error.InnerException.Message);
}
else
{
logmsg(success)
}
}
The error I am getting in the above method is -
System.Net.Mail.SmtpException: Failure sending mail. --->
System.NotSupportedException: Stream does not support reading.
at System.Net.Mime.MimeBasePart.EndSend(IAsyncResult asyncResult)
at System.Net.Mail.Message.EndSend(IAsyncResult asyncResult)
at System.Net.Mail.SmtpClient.SendMessageCallback(IAsyncResult
result)
--- End of inner exception stack trace ---
What am I doing wrong? The code seems to work fine if no attachment
is
supplied.
cheers
MB
- 6
- Visual C#.Net >> How to hide a property on DataGridIs there an attribute for a property on an object that saus :"This property
is not shown on a DataGrid" ?
I know it can be done on the grid itself, using DataGridTableStyle,
DataGridColumnStyle etc. But I`d like to get the same result by changing my
class, not at run-time changing grid`s behaveiour.
A small example:
public class User
{
private string m_Uid;
private string m_Name;
private string m_Pwd;
// UID should be visible on a DataGrid
public string UID
{
get {return m_Uid;}
set {m_Uid = value;}
}
// Name should be visible on a DataGrid
public string Name
{
get {return m_Name;}
set {m_Uid = Name;}
}
// PWD should *NOT* be visible on a DataGrid
//is there an attribute for this ?
[SomeAttribute.PreventBindingToGrid(true)] // this is what I`m looking
for
public string PWD
{
get {return m_Pwd;}
set {m_Pwd = value;}
}
} // End of User.
On a form with a DataGrid - gridUsers, We implement (implementation not
shown) a method to fetch users into an ArrayList of User objects, and bind
gridUsers to the list:
ArrayList alUsers = FetchUsers();
gridUsers.DataSource = alUsers; // Currently, the grid has 3 columns,
including PWD.
Can this be done (prevent PWD property from binding) ?
TIA Boaz Ben-Porat
DataPharm a/s
Denmark
- 7
- Winforms >> MDI OnMouseLeave problemHi,
There seems to be a problem with mouse event handling in controls located on
MDI child forms in .net v1.1. When the control is first made visible it
receives the OnMouse Enter and OnMouseLeave events. If the child form is
then hidden and re-shown only the OnMouseEnter event fires - thereafter
neither event fires, although oddly, OnMouseMove continues to fire.
The code below demonstrates the problem. Form1 is the mdi container and
Form2 is a child form that contains a button control. The main menu item on
Form1 is used to toggle the visibility of Form2. The button is subclassed to
show when the events fire. When form2 is hidden and then re-displayed, the
OnMouseEnter event fires when the button is entered, thereafter neither
event fires until Form2 is re-loaded, but OnMouseMove continues to fire.
If this is a genuine bug, I'd be grateful for any workaround tips.
Thanks
Jon
Imports System.Windows.Forms
Public Class Form1
Inherits Form
Public Sub New()
MyBase.New()
MainMenu1 = New MainMenu
MenuItem1 = New MenuItem
MainMenu1.MenuItems.AddRange(New MenuItem() {Me.MenuItem1})
MenuItem1.Index = 0
MenuItem1.Text = "Toggle"
Me.ClientSize = New System.Drawing.Size(200, 120)
Me.IsMdiContainer = True
Me.Menu = Me.MainMenu1
End Sub
Friend WithEvents MainMenu1 As MainMenu
Friend WithEvents MenuItem1 As MenuItem
Private WithEvents f2 As Form2
Private Sub MenuItem1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MenuItem1.Click
If f2 Is Nothing Then
f2 = New Form2
f2.Location = New Point(10, 10)
Me.AddOwnedForm(f2)
f2.MdiParent = Me
f2.Show()
Else
f2.Visible = Not f2.Visible
End If
End Sub
Private Sub f2_Closed(ByVal sender As Object, ByVal e As System.EventArgs)
Handles f2.Closed
f2.Dispose()
f2 = Nothing
End Sub
End Class
Public Class Form2
Inherits Form
Public Sub New()
MyBase.New()
Dim mb As New myButton
With mb
.Size = New Size(80, 30)
.Text = "winbtn1"
.Location = New Point(10, 10)
End With
Me.ClientSize = New System.Drawing.Size(120, 60)
Me.Controls.Add(mb)
End Sub
End Class
Friend Class myButton
Inherits Button
Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
MyBase.OnMouseEnter(e)
Console.WriteLine("mybutton mouse enter")
End Sub
Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
MyBase.OnMouseLeave(e)
Console.WriteLine("mybutton mouse leave")
End Sub
Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
MyBase.OnMouseMove(e)
Console.WriteLine("mybutton mouse move")
End Sub
End Class
- 8
- Winforms >> ContextMenuStrip on header of TabPage???Hi all,
On a Windows Form I have a TabControl and a ContextMenuStrip. Now I'm
trying to get the ContextMenuStrip only to be shown when right clicked
on the HEADER of the current TabPage (the TAB as I call it). Any ideas
(detecting the right clicking is not the problem of course, but my
context menu shows up on every location of the TabPage, not just the
header)? I once did this in Java (long time ago) so it must be
possible with .NET ;-)
Thanks for your help,
Fre
- 9
- Dotnet >> AddWatchIn VB6 I used to use AddWatch if I needed for instance to break if Text
property of the text box is changed to "Hello, World".
In VB.Net I'd like to do the same, but cannot find the way to do it.
AddWatch window doesn't give me the choice to select condition. I can set
condition on BreakPoint in the BreakPoint window only.
So, what do I have to do in order to catch the change of Text property of
the textbox or ActiveRow in Combo and so on?
Thank you
Vlad
- 10
- Visual C#.Net >> Javascript firing within a datagridI've got this great wee function which strips out the spaces entered into a
textbox and it does this on the key press off a user. I got this working in a
test application no problem however when I went to intergrate it with my real
application which has the textbox in the footer of a datagrid the javascript
doesn't seem to run. Has anyone any idea why this is not working for me?
Any help would be much appreciated. Thanks
Here is the function and the textbox which I'm using
<script language="javascript" type="text/javascript">
<script language="javascript" type="text/javascript">
function CheckValidAdd(textbox, val)
{
val = val.replace(/[^0-9a-zA-Z]/g, '');
textbox.value = val;
}
</script>
<FooterTemplate>
<asp:TextBox ID="add_NINo" onKeyUp="CheckValidAdd(add_NINo,
add_NINo.value);" Columns="5" Runat="Server" />
</FooterTemplate>
- 11
- Winforms >> Get reference to datagridview column from given coordinates.Does anyone know a method to retrieve a reference to the datagridview
column that contains given client coordinates?
Essentially I am trying to implement drag and drop functionality from a
listbox to a datagridview. In this case I am using an item dragged from
the listbox into the datagridview to rename the datagridview column
where that item is dropped.
I know how to implement the drag and drop functioanlity using events. I
just dont know how to get a reference to the actual column where the
item is dropped. So far I have gotten as far as being able to retrieve
the client coordinates in the datagridview of the actual drop point.
Anyone know how I can use those to get a reference to the column?
Thanks in advance for any help.
- 12
- ADO >> Datagrid Column WidthI found the following code on microsoft.support.com which is supposed to with of a column
'----------------------------------------------
Dim ts As New DataGridTableStyle(
ts.MappingName = "tbl_Client
DataGrid1.TableStyles.Clear(
DataGrid1.TableStyles.Add(ts
DataGrid1.TableStyles("tbl_Client").GridColumnStyles("First_Name").Width = 17
'--------------------------------------------------------------------------------------
Where tbl_Client is the Table name and First_Name is the column Name
But when I run the code I get the following error
Object reference not set to an instance of an objec
Thanks for your hel
- 13
- Dotnet >> VB.Net and DynamicsHello
Does anybody know if there is a way to dynamically have a dataset linked to a predefined crystal report? The project initially was created to deal with a few static reports but now my client has the need for much more reporting and it would be much easier to do this dynamically, if at all possible
Current situation
User is coming from a form where parameters for a report are specified. These are then passed to the form that will generate the Crystal Report. From this point, a dataset would be created and based on the information, the query that was sent to the database would be displayed in the CrystalReportViewer.
I have yet to figure out a way around this because the crystal report cannot be created without a predefined dataset, and this would seem to suggest that the dataadapter would also have to be predefined. :(
Is there a better way of doing this??
Cheers
Karl
- 14
- Dotnet >> ClickOnce: External component has thrown an exceptionHi,
When using clickOnce for a VB.NET 2.0 application it installs fine on every
computer, except one (a new one...). Every is isstalled, Framework, Mdac,
...
The error in the log file is: "External component has thrown an exception"
Does anybody knows what could have caused this problem?
Thansk a lot in advancec
Pieter
The full log file:
PLATFORM VERSION INFO
Windows : 5.1.2600.131072 (Win32NT)
Common Language Runtime : 2.0.50727.42
System.Deployment.dll : 2.0.50727.42 (RTM.050727-4200)
mscorwks.dll : 2.0.50727.42 (RTM.050727-4200)
dfdll.dll : 2.0.50727.42 (RTM.050727-4200)
dfshim.dll : 2.0.50727.42 (RTM.050727-4200)
SOURCES
Deployment url :
file://serverdata/LogicielTrading/Installer/Sogescol.Client.application
IDENTITIES
Deployment Identity : Sogescol.Client.application, Version=0.9.3.5,
Culture=neutral, PublicKeyToken=45ad061d5f374eff, processorArchitecture=msil
APPLICATION SUMMARY
* Installable application.
ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later
in the log.
* Activation of
\\serverdata\LogicielTrading\Installer\Sogescol.Client.application resulted
in exception. Following failure messages were detected:
+ External component has thrown an exception.
COMPONENT STORE TRANSACTION FAILURE SUMMARY
No transaction error was detected.
WARNINGS
There were no warnings during this operation.
OPERATION PROGRESS STATUS
* [23/05/2007 13:14:41] : Activation of
\\serverdata\LogicielTrading\Installer\Sogescol.Client.application has
started.
* [23/05/2007 13:14:42] : Processing of deployment manifest has
successfully completed.
ERROR DETAILS
Following errors were detected during this operation.
* [23/05/2007 13:15:59] System.Runtime.InteropServices.SEHException
- External component has thrown an exception.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Internal.Isolation.IStateManager.Scavenge(UInt32
Flags, UInt32& Disposition)
at
System.Deployment.Application.ComponentStore.SubmitStoreTransaction(StoreTransactionContext
storeTxn, SubscriptionState subState)
at
System.Deployment.Application.ComponentStore.SetPendingDeployment(SubscriptionState
subState, DefinitionIdentity deployId, DateTime checkTime)
at
System.Deployment.Application.SubscriptionStore.SetLastCheckTimeToNow(SubscriptionState
subState)
at
System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri
activationUri, Boolean isShortcut)
at
System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object
state)
COMPONENT STORE TRANSACTION DETAILS
* Transaction at [23/05/2007 13:15:59]
+ System.Deployment.Internal.Isolation.StoreOperationSetDeploymentMetadata
- Status: Set
- HRESULT: 0x0
+ System.Deployment.Internal.Isolation.StoreTransactionOperationType (27)
- HRESULT: 0x0
- 15
- ADO >> Subquery Problem in Query BuilderIn Visual Studio 2003 I'm not able to generate a dataset or tablemappings
for an Oracle DataAdapter as long as the SQL in the DataAdapter contains
subqueries (I'm using the Microsoft OLE DB Provider for Oracle and have an
Oracle 8 database). The query works just fine, though, and returns correct
data.
Here's the query ...
SELECT Equipment.*,
(SELECT Equip_IDs.ID_NUMBER
FROM Equip_IDs
WHERE Equip_IDs.ID_TYPE = 'TAG NUMBER' AND Equipment.Equip_ID =
Equip_IDs.Equip_ID) AS TAG
FROM Equipment
Good data is returned both running the query in the Query Builder and by
right-clicking the DataAdapter to "Preview Data."
Nevertheless, when closing the DataAdapter Configuration Wizard I get this
error ...
"There were errors configuring the data adapter."
and when trying to generate a dataset I'm told ...
"Syntax Error: found 'FROM' inside an expression"
Attempting to open the DataAdapter's TableMappings collection, this error
occurs ...
"Unable to retrieve the schema from the database table. Source column
mapping information will not be available. Would you like to continue?"
Anyone recognize what I'm doing wrong here? Appreciate any suggestions.
|
| Author |
Message |
Shmuel

|
Net Framework >> 2 decimal places, how?
How do I get a value to output as 2 decimal places.
I have 3 columns Target, Actual and Varience. When I do a
Target of 4.60 an Actual of 5.20 I get a Varience of
0.600000000000001. How do I get this to be 0.60? All the
values are declard as doubles.
Thanks all,
Jon
DotNet249
|
| |
|
| |
 |
| |
 |
Index ‹ DotNet ‹ Net Framework |
- Next
- 1
- Dotnet >> The chunk length was not valid when reading from streamHi,
i get errors when reading a stream from httpwebrequest on a HP ipaq pocket
pc. Framework 1.0 SP2
The same code runs sucessfully without errors on the 2003 pocket pc emulator
and on windows xp.
I have installed system.dr.dll to get the this detail error information,
before i got "could not find resource assembly".
Any ideas why ?
Thanks
Thomas
Here is the code:
HttpWebRequest webreq = (HttpWebRequest)WebRequest.Create(queryString);
HttpWebResponse webresp = (HttpWebResponse)webreq.GetResponse();
string ret= strm.ReadLine();
Exception: The chunk length was not valid
- 2
- Visual C#.Net >> Live Meter Data on the Web - Advice PleaseI've been asked to display some meter data on the web and I need preliminary
advice.
We have several hundred meters on site, with a system that writes out xml
files at 10 second intervals containing their data. (These files are
overwritten every 10 seconds, not appended to.)
First, I need to display two numeric pieces of this data just as numbers in
a web page. Naturally that's easy enough: where I'm stumped is REFRESHING
that data when it's updated every 10 seconds. Of course I don't want to
refresh the whole page, but only update a particular number when its
associated xml file is updated.
I've seen this done client side with javascript, but it was pretty cludgey.
Can ASP.NET help me here with a kind of persistant connection to these xml
files? (I thought the DataSet did such business out of the box, but it
doesn't as far as I can tell.)
Second, I need to use this data later for graphic trend displays. In other
words, I need to show in graph or chart form how each of these meters is
performing over time. Since the xml files are overwritten, I obviously have
to persist each piece of data somehow. I can think of any number of ways to
do this, but none of them seem too elegant. Any advice anyone might have
will help me think this through.
- 3
- Visual C#.Net >> XML writing errorHi all,
I have developped an application that generate XML documents.
At most time it works fine, but sometimes (when the size of data to export
is big) i got the error message :
<< The StartElement token in the Epilog state will generate a nonvalid XML
document :
at System.XML.XMLTextWriter.AutoComplete(Token token)
at System.XML.XMLTextWriter.WriteStartElement(String prefix, String
localName,String ns)
at System.XML.XMLTextWriter.WriteStartElement(String prefix, String
localName,String ns) at.....etc.>>
I have reviewed well formedness of my XML instructions but i have found no
error in them.
Please, give me any idea to track and solve the problem.
Thanks in advance.
- 4
- ADO >> access+Xp vs access+98sei have a database application using access written in csharp. it works well
on my computer with Windows XP . but when i run it under Win98 second
edition, if i try to insert , it catches an error: "..Operation must use an
updatable query...".
what would be the case here?
in fact , i am using dataAdapter's update method and i dont know what is
happening inside. Anyway i dont think there could a problem with this. it is
working well with XP..
- 5
- 6
- 7
- Net Framework >> Windows Service gives Access Denied errorHi.
Iâ??m writing a Windows service in C# that needs to run in the NetworkService
account, but when I create an Installer and set
ServiceProcessInstaller.Account to NetworkService on an otherwise unaltered
new project, I get an â??Error 5: Access Deniedâ?? message when I try to start
the service, even when logged in as Administrator.
Does anybody know why this is happening or how I can get around it?
Thanks in advance
- 8
- Net Framework >> http error codes...hi,
i need to write a script whcih monitors my web application....
I'm using a third party tool called NetMon .......designed by our client
himself........
I need desgin a web page(.aspx) which does the monitoring functionality like
chekcing connectivity to teh databsbe, to the web server etcc..
can anyone let me know the way to capture the error whcih i get whenever i'm
uable to connect to the web server..
- 9
- Visual C#.Net >> PadRightIs there something wrogn with this syntax? It does not put in the padded
characters.
string hk="Assembly";
hk.PadRight(35,'-');
this.textBox1.Text=hk + "Test";
The output is AssemblyTest
- 10
- Visual C#.Net >> Mutex and messagesHi,
I have a WinForms desktop MDI application written in C#. Following advice
from others in this forum, I prevent multiple instances of the app running
at the same time by creating / trying to create a mutex, as follows:
bool blnCreatedMutex;
objMutex = new System.Threading.Mutex(true, "zzzzzzMyCoolAppzzzzz", out
blnCreatedMutex);
if (!blnCreatedMutex)
{
MessageBox.Show("My Cool App is already running", "Error",
MessageBoxButtons.OK, MessageBoxIcon.Stop);
this.Close();
return;
}
The app saves data files onto the file system, and I have associated these
files' extension with the app's executable. All is well - I interrogate the
args property when the app loads and try to open any files found there e.g.
foreach (string strArg in astrArgs)
{
openFile(strArg);
}
No doubt you can all guess the next question... :-) if the app is already
running, and the user double-clicks one of its files, I want to somehow get
a message to it to open the file(s) found in the args of the second
instance, which I will then terminate.
Any assistance gratefully received.
Best,
Mark
- 11
- Net Framework >> color code of textboxhi,
here is weird reqmt..
i need the color code of the textbox control 's border style,(Fixed 3d)....
by default, what is the color code set for it's border....please help out
- 12
- Visual C#.Net >> wmi memory leak?if I repeatedly call the following method on my winxp machine (and many
others) the svchost.exe process increases its memory very very quickly, and
doesnt go back donw, I have machines that after a day have svchosts taking 1
gig of ram, thank god I have 3 more to spare!
public static void GetNetworkProperties(String NetConnectionID)
{
try
{
SelectQuery sq = new SelectQuery("select * from Win32_NetworkAdapter where
NetConnectionID=\""+NetConnectionID+"\"");
ManagementObjectSearcher mos = new ManagementObjectSearcher(sq);
foreach(ManagementObject mo in mos.Get())
{
foreach(PropertyData data in mo.Properties)
{
if(data.Name.Equals("Index"))
{
ManagementObjectSearcher query1 = new ManagementObjectSearcher("SELECT
DefaultIPGateway,IPAddress,DNSServerSearchOrder,DHCPEnabled,IPSubnet,MACAddr
ess FROM Win32_NetworkAdapterConfiguration where Index="+data.Value);
ManagementObjectCollection queryCollection = query1.Get();
String[] ips = null;
String[] dns = null;
bool dhcp = false;
String[] subnet = null;
String mac = null;
String[] gateway = null;
foreach(ManagementObject adapter in queryCollection)
{
foreach(PropertyData prop in adapter.Properties)
{
switch(prop.Name)
{
case "IPAddress":
if ( prop.Value != null)
{
ips = (String[])prop.Value;
}
break;
case "DNSServerSearchOrder":
if ( prop.Value != null)
{
dns = (String[])prop.Value;
}
break;
case "DHCPEnabled":
if ( prop.Value != null)
{
dhcp = Convert.ToBoolean(prop.Value);
}
break;
case "IPSubnet":
if ( prop.Value != null)
{
subnet = (String[])prop.Value;
}
break;
case "MACAddress":
if ( prop.Value != null)
mac = prop.Value.ToString();
break;
case "DefaultIPGateway":
if ( prop.Value != null)
{
gateway = (String[])prop.Value;
}
break;
}
}
}
}
}
}
}
catch(Exception exe)
{
}
}
- 13
- Visual C#.Net >> Deployment projectsWe want to deploy a large CSharp/SQL Server system.
We are successfully using the 'setup project' (under setup and
deployment projects) to build our deployed system.
With our stored procedures, we would ideally like the facility to be
able to automatically add all our stored procedures in SourceSafe/disk
to the deployment project without having one of us having to select
them manually and adding them. That way, we could build our deployment
projects automatically even if we have a number of new stored
procedures in each deployment.
Basically, we want our deployment to contain assemblies (known) and a
variable number of stored procedures.
One way is to write a program that creates a deployment solution file
based on the stored procedures + all the necessary other files, but we
would prefer not to do this if there is a better way.
Does anyone have any bright ideas?
- 14
- Dotnet >> datatable.HasChanges() ?Gday,
Have been going through the walkthrough for a distributed application:
http://msdn2.microsoft.com/en-us/library/1as0t7ff.aspx
and it appears to suggest in the SaveData_Click method that you can check a
datatable for changes, ie
if (CustomerData.HasChanges())
However when I try to build this I get the error:
Error 1 '<blah>DataTable' does not contain a definition for 'HasChanges'
Am I doing something stupid or do datatables not have this method available?
Thanks,
Peter
- 15
- Visual C#.Net >> Trying to impersonateI'm trying to impersonate a admin user when retrieving picklist items in
Microsoft CRM. When
a windows 2000 user is opening the code it is getting a popup asking the
username, password, and domain.
Can someone please help??
The coce i am using is this,
System.Net.CredentialCache MyCredentials = new System.Net.CredentialCache();
System.Net.NetworkCredential MyNetCred =
new System.Net.NetworkCredential(@"user",@"password",@"CRM");
MyCredentials.Add
(new Uri(strDir + "BizUser.srf"), "NTLM", MyNetCred);
MyCredentials.Add
(new Uri(strDir + "CRMCustomization.srf"), "NTLM", MyNetCred);
MyCredentials.Add
(new Uri(strDir + "CRMContact.srf"), "NTLM", MyNetCred);
MyCredentials.Add
(new Uri(strDir + "CRMQuery.srf"), "NTLM", MyNetCred);
//BizUser object
bizUser = new Microsoft.Crm.Platform.Proxy.BizUser();
bizUser.Credentials = MyCredentials;
bizUser.Url = strDir + "BizUser.srf";
// CRMCustomization proxy object
Microsoft.Crm.Platform.Proxy.CRMCustomization customization = new
Microsoft.Crm.Platform.Proxy.CRMCustomization();
customization.Credentials = MyCredentials;
customization.Url = String.Concat(strDir, "CRMCustomization.srf");
//create CRM Contact proxy object
Microsoft.Crm.Platform.Proxy.CRMContact contact = new
Microsoft.Crm.Platform.Proxy.CRMContact();
contact.Credentials = MyCredentials;
contact.Url = String.Concat(strDir, "CRMContact.srf");
//create CRM Account proxy object
Microsoft.Crm.Platform.Proxy.CRMAccount account = new
Microsoft.Crm.Platform.Proxy.CRMAccount();
account.Credentials = System.Net.CredentialCache.DefaultCredentials;
account.Url = String.Concat(strDir, "CRMAccount.srf");
// Query proxy object
Microsoft.Crm.Platform.Proxy.CRMQuery query = new
Microsoft.Crm.Platform.Proxy.CRMQuery ();
query.Credentials = MyCredentials;
query.Url = strDir + "CRMQuery.srf";
try
{
Microsoft.Crm.Platform.Proxy.CUserAuth userAuth = bizUser.WhoAmI();
userAuth = this.bizUser.WhoAmI();
}
|
|
|