|
Hello!
Check out the articles and search for TCP, UDP and Socket. You will find there something helpful.
Marcel Erz
|
|
|
|
|
|
Are you talking about having an application sitting on both computers and sending files between them? Or do you mean via Windows Network file sharing?
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Bought a House!
Judah Himango
|
|
|
|
|
I just want tohave an application sitting on both computers and sending files between them. Thanks
dingwei
|
|
|
|
|
Look at .NET remoting. This can be easily done once you've setup an applicaton on both ends that listens for a particular message on a particular port.
|
|
|
|
|
hello,
I am having problems with the following code,it is raising a timeout exception....
code:
-----------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace SQLdbConnection
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Initial
Catalog=db1;data source=local;integrated security=sspi;");
con.Open();
SqlDataAdapter dA=new SqlDataAdapter("select*from t1",con);
DataSet dS=new DataSet();
dA.Fill(dS,"T1");
}
}
}
---------------------
exception error:
----------------------
See the end of this message, instead of this dialog box, for details on invoking
just-in-time (JIT) debugging.
************** Exception Text **************
System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup)
at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
at SQLdbConnection.Form1.button1_Click(Object sender, EventArgs e) in E:\MSVS2005\AllProjects\SQLdbConnection\SQLdbConnection\Form1.cs:line 26
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50215.44 (beta2.050215-4400)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50215/mscorlib.dll
----------------------------------------
SQLdbConnection
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///E:/MSVS2005/AllProjects/SQLdbConnection/SQLdbConnection/bin/Debug/SQLdbConnection.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50215.44 (beta2.050215-4400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50215.44 (beta2.050215-4400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50215.44 (beta2.050215-4400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50215.44 (beta2.050215-4400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50215.44 (beta2.050215-4400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Data
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50215.44 (beta2.050215-4400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Transactions
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50215.44 (beta2.050215-4400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50215.44 (beta2.050215-4400)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitdebugging="true">
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
---------------------------
Please help me out,I think there is some provider error.....
-- modified at 8:55 Tuesday 13th December, 2005
|
|
|
|
|
In a windows application there is a App.Config
In it I have included the following line.
<configuration>
<appSettings>
<add key="ConnectionString" value="Server=localhost;DataBase=Northwind;Integrated Security=SSPI;Connect Timeout=5"/>
</appSettings>
</configuration>
in a class module this is how I am trying to access this connection string:
return System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"]
The problem is that it returns null.
Any thoughts please?
Thanks
|
|
|
|
|
Just a long shot, here. Did you actually name it App.Config? If so, then you need to name it <executableordllname>.config. So, if you application is named foo.exe, then your configuration file should be named foo.exe.config.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Please have a look at the app.config details where the connection string is set.
Thanks
|
|
|
|
|
Okay, I just created a Windows Forms project named WindowsApplication4. I added the following line to my form1 constructor.
Text = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"] I compiled the application. It created an executable named WindowsApplication4.exe. I took the XML that you posted, put it in a file named WindowsApplication4.exe.config and put that in the same directory as the executable. I ran the executable. The caption on my window then read "Server=localhost;DataBase=Northwind;Integrated Security=SSPI;Connect Timeout=5".
If you don't name the .config file properly, you cannot use it with your application.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
In a windows application there is a App.Config
In it I have included the following line.
<configuration>
<appsettings>
<add key="ConnectionString" value="Server=localhost;DataBase=Northwind;Integrated Security=SSPI;Connect Timeout=5">
in a class module this is how I am trying to access this connection string:
return System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"]
The problem is that it returns null.
Any thoughts please?
Thanks
|
|
|
|
|
Click the "Ignore HTML tags in this message (good for code snippets)" checkbox in your message so we can see your config file
|
|
|
|
|
I have a website with member login feature. I need to authenticate the users against both the site's database and the Microsoft Active Directory. I'd like to this authentication without sending the password through the network that means i'd like using digest authentication. If i activate the digest authentication support in IIS then i'll not be able to authenticate against the database and if i write and HttpModule to handle the digest authentication process then i'll need the password of each user from AD.
The question is, is there any solution to retrieve the user's password or at least an MD5 hash of it from AD?
Osama Askari
programmer.askari@gmail.com
|
|
|
|
|
How can I launch the file properties window (i.e. the window launched by right clicking in windows explorer -> properties) from a win forms app (I have the filename).
Jim
-- modified at 7:20 Tuesday 13th December, 2005
|
|
|
|
|
First, declare the following in your class.
private const int SEE_MASK_INVOKELIST = 0xC;
public struct SHELLEXECUTEINFO
{
public int cbSize;
public int fMask;
public IntPtr hwnd;
[MarshalAs(UnmanagedType.LPTStr)] public string lpVerb;
[MarshalAs(UnmanagedType.LPTStr)] public string lpFile;
[MarshalAs(UnmanagedType.LPTStr)] public string lpParameters;
[MarshalAs(UnmanagedType.LPTStr)] public string lpDirectory;
public int nShow;
public IntPtr hInstApp;
public IntPtr lpIDList;
[MarshalAs(UnmanagedType.LPTStr)] public string lpClass;
public IntPtr hkeyClass;
public int dwHotKey;
public IntPtr hIcon;
public IntPtr hProcess;
}
[DllImport( "shell32.dll", CharSet=CharSet.Auto )]
static extern bool ShellExecuteEx( ref SHELLEXECUTEINFO lpExecInfo ); Then, in your code, invoke it with the following.
SHELLEXECUTEINFO info = new SHELLEXECUTEINFO();
info.cbSize = System.Runtime.InteropServices.Marshal.SizeOf( info );
info.lpVerb = "properties";
info.lpFile = @"THE\PATH\TO\YOUR\FILE\HERE";
info.hwnd = Handle;
info.fMask = SEE_MASK_INVOKELIST;
ShellExecuteEx( ref info ); .Now, more importantly, I had no idea how to do this until you asked. Here's how I figured it out.- I Googled for: C# "file properties" dialog. This led me to learn about using ShellExecuteEx.
- Go to http://www.pinvoke.net to learn about ShellExecuteEx.
- Copied the code from the Web page to my project and BAM! it worked.
Now, you have an immediate and long-term answer. <smile />
|
|
|
|
|
Thanks, I did search on Google but not with quite the right phrase it seems. Thats another site for the bookmarks
Jim
|
|
|
|
|
Jim,
Glad I could help. I understand the "not with quite the right phrase" deal. I have done some interesting research into Information Retrieval and understand that Google is powerful for pretty simple searches, but not the contextual stuff.
I hope that last section didn't sound too pedantic. I don't want to insult your intelligence. Just thought I'd give you an insight into my problem solving steps.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Hi, i'm just about to start quite a large project that i'd like to use the Enterprise Library blocks for. I can see massive benefits of using the library but have come across a huge problem, for me at least.
I use DataRows / DataTables to pass to and from my Dal, all the Business objects have a ToDataRow, FromDataRow that maps DataRow columns to Business attributes. This allows me to contruct classes from Datatables (Collections) or from a single DataRow. I did things this way specifically because using the old Data Access application block I could get a list of SqlParameters (SqlHelperParameterCache.GetSpParameterSet) from a stored procedure then map these to the DataRow columns using sproc param name and column name and not have to worry about providing specific mappings for every stored procedure, and I could just write a BaseClass that did most of the functionality for me, all the DalcClasses did was specify a sproc name, and pass on the DataRow produced from the Business object, e.g.
User Business Class
DalcUser.Update(this.ToDataRow());
User DALC:
public static void Update(DataRow drUser)
{
BaseUpdate("UpdateUser", drUser);
}
I don't see anyway of doing this in the Enterprise Library anyone any ideas. Should I just change to using DataSets I just find them overkill considering most of the time all you want is a DataRow, even then i don't think this is solved.
Many Thanks
Tim
|
|
|
|
|
Using AOP you can save and load data without using any of that
You can use reflection to automatically populate a class based on the fields from a reader
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
How can I check if a int is NaN?
|
|
|
|
|
|
my application does some math calculations, but sometimes the result is NaN as caused by sqrt(-2) for example, I would not want to display such results
|
|
|
|
|
An int can't be NaN. NaN is only available in the floating point numeric formats (float.IsNaN(myNumber) ).
You are probably looking for nullable types which are newly available in .Net 2.0.
|
|
|
|
|
float.IsNaN(myNumber) seems to be useful, thanks!
|
|
|
|
|
if you uses an object with a variable int, and that object is populate in an api, and not pass a value to variable int, then the value can by null, that way you can obtain a value not int
|
|
|
|
|