|
Yes, WindowsApplication4.exe.config is the .config file for the Windows Forms application because the name of the application is WindowsApplication4.exe.
It is located in the same directory as WindowsApplication4.exe.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
ok, so now I will place my appsetting lines in the app.config in the clinet side.
|
|
|
|
|
That should work for you. Hope all turns out well. Happy coding.
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
This is now clear.
The whole picture is that I have a client layer with the forms and now tha app.config file (for the connection string).
This client layer now connects to the business layer.
The business layer connects to the webservice and the webservice connects to the datalayer where the connection string is required.
How do I get the connectioinstring into the datalayer ?
Thanks
|
|
|
|
|
If I understand this correctly, you have the following architecture.
Client Application <-> Business Layer <- INTERNET -> Web Service <-> Data Layer
Windows Forms App Class Library Web Service Class Library The assemblies you have will use the following .config files:
- Client Application
- uses the <applicationName>.exe.config file for the client application
- Business Layer
- uses the <applicationName>.exe.config file for the client application
- Web service
- uses the web.config file for the Web service
- Data Layer
- uses the web.config file for the Web service
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
Thank you. I can now use the connection string inside my n-tier application.
|
|
|
|
|
I am happy to hear that. Happy coding!
"we must lose precision to make significant statements about complex systems."
-deKorvin on uncertainty
|
|
|
|
|
I'm having a problem that is really driving me nuts. The setup heres a little complicated, so please bare with me:
I have a dll that contains a class, let's call it Manager, it's job is to search a directory, find other dlls and search them for classes that implement a certain interface, lets call it ICalc. It uses Assembly.LoadFrom to do this. It maintains a list of all the classes it finds that implement ICalc (in an arraylist of Type objects) and returns information about those classes (name and version) to the client program. Manager also has a method, let's call it GetCalc, that will instantiate and return an object that implements ICalc of a type requested by the caller. So far so good, and this seems to work okay.
Now I have another dll that contains a class, lets call it MyCalc that implements ICalc. When MyCalc is instantiated it must instantiate a few other objects that are related to its function. Among these are a class that contains some settings, lets call it MySettings. These settings are actually serialized to the disk and deserialized again by MyCalc using a static method in MySettings, something like:
public static MySettings LoadSettings(string filename)
Hopefully, you are still following this. Now, I create a simple C# console application to test this out and everything works fine - great!! But here's the problem, I'm trying to use LabView[^] as the client for the Manager Dll and this is were I run into trouble. For some reason the deserialization no longer works and chokes with an "Invalid Cast" exception. Basically the line:
MySettings setting = (MySettings) MyFormatter.Deserialize(MyStream)
Doesn't work.
Does anybody have any clue why this might be? I'm really confused by this. I have a guy (a LabView developer) waiting for my DLL and I can't figure this out!
|
|
|
|
|
No direct idea what happens but you could find out by checking the type before casting:
object o = MyFormatter.Deserialize(MyStream);
Console.WriteLine(o.GetType().Fullname);
This probably gives you a hint on whats going wrong.
|
|
|
|
|
Thanks for your reply. I have checked the type of the object returned from deserialization and it is the correct type as far as I can tell. I think the problem is rooted in how the assemblies are being loaded but I'm having a hard time getting to grips with it.
|
|
|
|
|
Hi all,
I have developed a dll in Win32. That dll finds the updated regions
of the desktop and then post these regions data to a C# application
using PostThreadMessage(). But problem is here i m not so much use to
with C# so i havent any idea how can i get it from the Application
message queue of my C# application.
Thanx
|
|
|
|
|
Has somebody used VTAPI ACTIVE X CONTROL in c# application ?
If "yes", can tells me how do it ?
Bye from Italy !
|
|
|
|
|
Is there a simple function to return a boolean value whether someone is connected to a network and/or the internet?
Thanks
Brent
|
|
|
|
|
u do one thing that on network(If it is LAN then) ping to each node.
and if it give response(means node) then it is connected else not
if u have difficulty that how to ping node in .net u can mail me
prakash_paghdal@gmail.com
|
|
|
|
|
|
Me again!
Here is the API call for C#:
[DllImport("sensapi.dll")]
private extern static bool IsNetworkAlive(ref int flags);
Like in VB.Net, you can use it in this way:
int liReturn = 0;
if IsNetworkAlive(liReturn) {
// ... Your code (if connected)
} else {
// Not connected code
}
Marcel Erz
|
|
|
|
|
Thanks for the suggestions. I also found the System.Net.Sockets.TcpClient class which lets me test connect to a remote server.
Brent
|
|
|
|
|
How could I send and receive files between two computers in the LAN? Could someone give me some hints or codes of C#?
Richard
|
|
|
|
|
With a pigeon...
(No offense just in the mood for joking)
|
|
|
|
|
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
|
|
|
|