|
|
Then you are probably looking for Linq to SQL , but I recommend SQL.
You'll never get very far if all you do is follow instructions.
|
|
|
|
|
PIEBALDconsult wrote: Then you are probably looking for Linq to SQL Can we expect any blogpost/article from you? Meanwhile....[^]
thatrajaCode converters | Education Needed
No thanks, I am all stocked up. - Luc Pattyn
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is - Henry Minute
|
|
|
|
|
Since Access runs entirely on SQL to manipulate the database, how else are you going to get the data out of it??
This sounds like an excuse for "I don't know SQL and don't want to learn it." Do yourself a favor and LEARN IT. You're not going to have a very good software development life without it.
|
|
|
|
|
<NoteToSelf>Create sockpuppets and upvote Dave's post a few more times.</NoteToSelf>
You'll never get very far if all you do is follow instructions.
|
|
|
|
|
|
Hi Everybody,
I want to use functions having callback in remoting mode.Summary of scenario is
1) I am having a shared class library which has a functions which contains callback
2)Server as standalone application which used to take session from shared class library
3)Client as standalone application which takes session from serer and then call the functions on it
Summary of my code is:
SharedLibrary:
namespace TestClassLibrary
{
public class Class1 : MarshalByRefObject
{
public delegate void NotifyCallback(string s);
public void SelectWithClassDialog(string msg, NotifyCallback callback, string title)
{
Console.WriteLine("SelectWithClassDialog");
Console.WriteLine(msg);
Console.WriteLine(title);
if (callback != null)
s_notify(callback);
}
}
public class TestSession : MarshalByRefObject
{
internal TestSession()
{
}
new internal void initialize()
{
_cls1 = new Class1();
}
private Class1 _cls1;
public Class1 Class1
{
get
{
return _cls1;
}
}
static private TestSession theSession;
public static TestSession GetSession()
{
lock (typeof(TestSession))
{
if (theSession == null)
{
theSession = new TestSession();
theSession.initialize();
}
}
return theSession;
}
} ServerCode:
namespace TestServer
{
class TestServer
{
static void Main()
{
Thread serverThread = new Thread(new ThreadStart(Run));
serverThread.Start();
}
public static void Run()
{
int port = 1234;
TestSession theSession = TestSession.GetSession();
LifetimeServices.LeaseTime = System.TimeSpan.FromDays(10000);
// Create a custom FormatterSinkProvider so that we can set its security type
// filter to Full. This is necessary for ObjectRefs to be deserialised
SoapServerFormatterSinkProvider provider = new SoapServerFormatterSinkProvider();
provider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilter Level.Full;
// Create the IDictionary to set the port on the channel instance.
IDictionary props = new Hashtable();
props["port"] = port;
// Create a new HTTP channel with the given provider and properties
HttpChannel channel = new HttpChannel(props, null, provider);
ChannelServices.RegisterChannel(channel, false);
// Export the Session object
RemotingServices.Marshal(theSession, "TestSession");
// Create the server object for clients to connect to
RemotingConfiguration.RegisterWellKnownServiceType (
typeof(ClientComms),
"RemoteServer",
WellKnownObjectMode.Singleton);
Thread.Sleep(Timeout.Infinite);
}
}
}
Client code:
namespace Client
{
class Program
{
private static TestSession theSession = null;
static TestClassLibrary.NotifyCallback ip = init_proc_body;
static void Main()
{
Console.WriteLine("Getting TestSession object...");
theSession = (TestSession)Activator.GetObject(typeof(TestSessio n), "http://localhost:1234/TestSession");
if (theSession == null)
{
Console.WriteLine("No Session object found. Exit.");
return;
}
Console.WriteLine("Got Session object");
theSession.Class1.SelectWithClassDialog("test", ip, "test_str"); // got exception here
}
public static void init_proc_body(String s)
{
Console.WriteLine("Inside callback");
Console.WriteLine(s);
}
}
}
In client I am trying to call function SelectWithClassDialog("test", ip, "test_str"); at this statement I will get an exception
System.Reflection.TargetInvocationException was unhandled
HResult=-2146232828
Message=Exception has been thrown by the target of an invocation.
Source=mscorlib
InnerException: System.IO.FileNotFoundException
HResult=-2147024894
Message=Could not load file or assembly 'Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
Source=mscorlib
FileName=Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
If I run client program in non remoting then it works fine.(In non remoting mode I am directly taking session from shared lib in client application and then calling resp. function)
Also in remoting mode if I make call like SelectWithClassDialog("test", null, "test_str");
then it works fine.
So I think problem is with callback in remoting mode.
Can anybody help how to use SelectWithClassDialog("test", ip, "test_str"); in remoting mode with callback.
I am new to c# and stuck at this point,would appreciate any help.Thanks in advance.
|
|
|
|
|
|
Your problem is that you are binding the delegate to a method in a Client assembly class. That means that the code that tries to call it needs to know about that assembly, which is obviously bad.
In this situation when you're passing the delegate to a method which calls it directly, you can use an interface instead:
SharedAssembly:
interface IStringMessageRecipient {
void ProcessMessage(string s);
}
class Class1 {
public void SelectWithClassDialog(string msg, IStringMessageRecipient messageRecipient, string title) {
messageRecipient.ProcessMessage("did " + title);
}
Client:
class Client : IStringMessageRecipient {
IStringMessageRecipients.ProcessMessage(String s) {
Console.WriteLine("Inside callback");
Console.WriteLine(s);
}
}
PS please use <pre> tags for code blocks.
|
|
|
|
|
Thanks for the reply..
The approach of interface works but for that I need to open a port in client also.
HttpChannel channel = new HttpChannel(0);
ChannelServices.RegisterChannel(channel, false);
Now problem is that in actual scenario I have a c# wrapper over C.
So when in this case I used the Interface approach I got error like
No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE))
Can you please help me in fixing this problem.
|
|
|
|
|
smit_a wrote: The approach of interface works but for that I need to open a port in client also.
No you don't, you should be able to use exactly the same approach as before. Remoting is supposed to handle all the marshalling for you. I'm not an expert in this area though.
However, your C code is unlikely to be able to call anything that's passed over from the client side.
|
|
|
|
|
I dont know how to use the treeview in a sales form for getting the data from database. what is the main structure i want to show in tree view is
+Catagories
Company
Product
|
|
|
|
|
|
Hi to All,
I am working on C# Winform application (Visual Studio 2010) with MySql as back-end. Meanwhile I am looking for a suitable solution to a problem about How will I deploy this application along with MySql server. As this will be multiuser application, embedded database is not an option. It need to be a server based.
There should be one server, for which this combine deployment is required, for client, ofcourse only application installation is required.
So what are the options do I have for deployment? If I am offering this application available for download from a website, should I break it into 2 separate downloads? One is MySql itself (I am using XAMPP bundle for MySql because it is easy and portable), Second is the application alongwith it's all dependencies. If this approach is followed, then I've to setup whole database required by application from within the application (which I think is not so difficult). But then end user have to download the whole package of MySql, is there anyway I can reduce the size of whole XAMPP package as I am only using MySql database, As I don't use anything else in XAMPP (PHP/Apache/Mercury Mail etc) can I remove them so that size of bundle will be small enough for end user to download?
I've searching long for the solution, and many forums has many questions about it, but there are no helpful solutions. I am looking for better solution from experts of this forum.
Thanks and best regards
Ahmed
|
|
|
|
|
There should be some tutorials out there explaining how to create a .Net deployment (including sub-installs...). This requires some fiddling around though, but it can certainly be done.
A second option is to write an install script yourself. This is probably the easiest way. You create a zip folder the people can download with an install.xxx or setup.xxx script that executes the correct install programs included in the zip file.
Third option is as you say. It is less user friendly so you're required to write a good reference about how they should install it, complete with troubleshooting guide.
Hope this helps.
|
|
|
|
|
V. Thanks for your reply, I guess 2nd option will be more feasible for me. Can u guide me to some good tutorials/samples related with my issue? Like MySql and C# winform application.
Regards
Ahmed
|
|
|
|
|
if you're deploying on windows machines any batch or WMI script will certainly do the trick as they run natively. (eg perl or python need the libraries installed) For Unix systems you'll need another script.
There are plenty tutorials out there so I advice to choose one and go through it. When you get the hang of it you need to check how to install MySql and .Net assmblies through command lines. Google will present more information then I can.
There is no quick solution I can give you as this custom for your situation. Google is your friend.
In this case, there is no shortcut or quickfix, this will have to go via the hard way...
|
|
|
|
|
V. Thanks for your reply again, despite of fact that there are no quickfix or shortcut, and if choose between WMI Scripts or batch, end-use still have to download the complete bundle alongwith MySql server, if the server installation is required. Only then will batch or script will work.
|
|
|
|
|
No, you install the server. The end user just needs to install the client.
Perhaps only some dll's are necessary, perhaps it's worth while to look that up.
|
|
|
|
|
Ahh...I think I've not make myself clear regarding my issue.
This application is not for my organization, it is commercial software, general purpose accounting application. So any organization that needs it will download from website and do the install (server or client). I need to provide them some quick and easy way to do both installations as an when required. For server PC, the installation will be Application + MySql Server and for client PC only Application required.
|
|
|
|
|
In that case I would just write a disclaimer stating MySQL server is required for this application to run, with a link where you can get it. In principle it is not a part of the application and it's best to avoid "responsibility" for something you don't own.
|
|
|
|
|
But I thought MySql is free or opensource? doesn't that make it freely distributable? Secondly, how about I distribute XAMPP with my application? As it is lot easier to use then to configure/install actual MySql server?
|
|
|
|
|
ahmed_one wrote: But I thought MySql is free or opensource?
It is free, but you don't "own" it? I'm not sure what your problem is here .
MySQL is a fully supported system with documentation, tuning packages, blogs, forums and what not.
And yes you "can" distribute it, but if you do, you're basically stating that you will provide support when it doesn't work. IOW if I would use your product and I install the server and it does not work, I will call you. If you tell the user MySQL is a requirement for your application to run, the client needs to install and configure MySQL himself. The first person to call in case of problems are the MySQL people.
Also make sure that your installation creates the database
I have no experience with XAMPP so I can't say anything about that.
|
|
|
|
|
Yes that was confusing till now...Thank you...
So then I will let the user know that MySql is must for using the application. Or point them to XAMPP so that they only need to download the package without having the trouble of configuring it, it's just download and run, so it will be much less hassle for them.
Thanks a lot for your guidance.
Regards
Ahmed
|
|
|
|
|
no problem. Glad to have been of some humble assistance
|
|
|
|