|
Aaaa. It should. You didn't mention it in first post Maybe firewall is blocking access to the server?
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
|
|
|
|
|
Sorry , but its not going to a server, let me explain in detail...
after you installed the app from the network you login on the program then a mdf is saved to that users's pc, so the program reads from that mdf file on that users's c drive
|
|
|
|
|
This is starting to be interesting
The error message you get looks as if the application tried to connect to SQL Server (not using express edition).
Maybe your app.config has some error (for example you don't set provider or something like this).
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
|
|
|
|
|
No beleive me everything is in there, appconfig etc.
This is one of those things I cant get my head around
here is my appconfig : <add name="ConnectionString1" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Folder\Databse\File.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
|
|
|
|
|
You're using SQL Server. ./SQLEXPRESS in DataSource indicates instance of SQL Server. Check the firewall settings and if the SQL service is up. And if the instance of the SQL Server on the machine is named SQLEXPRESS.
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
|
|
|
|
|
1, caculate th EPF in basic salary,
2, reduction in the salary,
3, up to 75% working day count the per month bonus ruppess 90,
4, less to 75% working day count the per month bonus ruppess 90,
5, in form include the attentance
finaly calculate th enet salary..........
|
|
|
|
|
Ok, this is what you need, but what are you expecting here? Nobody will do the work for you!
|
|
|
|
|
Well, you have the basics of a design there. You need to flesh it out a bit.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
What have you tried so far?
|
|
|
|
|
Real programmers don't work for ruppess.
|
|
|
|
|
I disagree.
I work to pay for games.
I like Zelda.
So I work to pay to get Zelda.
The currency in Zelda games is usually rupees.
Ergo I do work for rupees.
|
|
|
|
|
Ummm... oookaaayyy... what does that have to do with ruppesses?
|
|
|
|
|
Hi,
How can i change color for statusbar????? winform app.
krishna
|
|
|
|
|
statusStrip1.BackColor = Color.Red;
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
Hi,
I am wondering, is there any technique available to copy an object to another object when the objects are of different class but the signature of these classes are same (100% identical) ? For example, if I have
class A
{
public string Name;
public string EmailAddress;
}
and
class B
{
public string Name;
public string EmailAddress;
}
Now, in my code, I have a::A , b::B .
I want to copy all property values from b to a, but I have to do it manually by iterating all properties of b to a one by one like this.
a.Name = b.Name;
a.EmailAddress = b.EmailAddress;
I wish if there were any techniq to automate this task!! I know about Copy/Cloning techniques where the objects are from same class. But as you see my objects are from different class. If my class were so simply like this, I would not have worried, but my class A and B has around 50 properties which is hard to maintain. So, I would appreciate any idea.
Regards.
|
|
|
|
|
1) you could inherit from the class that has all your properties then still would be able to use reflection or cloning or etc.
2) in each class have the same sub class which will have the same properties so then pass from one to the other either by using reflection or cloning or etc.
3) one way is to use an interface. implement each property that would exist in each class and use reflection to pass the information by going after the interface in both classes.
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
modified on Thursday, August 5, 2010 9:03 PM
|
|
|
|
|
Hi,
Thanks for your reply. Actually, my classes are auto generated and I dont have control over them. I mean, my class A is a LINQ to SQL model generated from the dbml file, and class B is a proxy class for a WCF Service. Yeah, I can manipulate those classes manually but it will be hard to maintain when I will update my service reference or dbml file. So, I was looking for some other technique that can take an object of class A and return object of class B where all properties of A is copied to B.
|
|
|
|
|
ah. i would just use reflection then. get all the properites available from class A and then go through all the properties of class B. if there is a match then copy the data from A to B.
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
|
|
|
|
|
Thanks again. I am not familiar with Reflection. Would you please give me any example snippet Or point me to an article which shows how to do this task as you mentioned ?
|
|
|
|
|
Forgive...i'm a lowly VB programmer and i just quickly threw this together - so translate it and it should do what your looking for
Imports System.Reflection
Public Class Form1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim a As New TheFromClass With {.Hello = "hello there", .Name = "myclass"}
Dim b As New TheToClass With {.GoodBye = "later dude", .Hello = "wuzup"}
Dim ta As Type = GetType(TheFromClass)
Dim tb As Type = GetType(TheToClass)
Dim obj As Object, PropertyName As String, ToPI As PropertyInfo = Nothing
MsgBox(b.Hello)
For Each FromPI As PropertyInfo In ta.GetProperties
PropertyName = FromPI.Name
obj = FromPI.GetValue(a, Nothing)
ToPI = tb.GetProperties.Where(Function(p) p.Name = PropertyName).FirstOrDefault
If ToPI IsNot Nothing Then ToPI.SetValue(b, obj, Nothing)
Next
MsgBox(b.Hello)
End
End Sub
End Class
Public Class TheFromClass
Public Property Hello As String
Public Property Name As String
End Class
Public Class TheToClass
Public Property GoodBye As String
Public Property Hello As String
End Class
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
|
|
|
|
|
Thanks a loooooooooooooot. I highly appreciate.
Yes, I know some online VB to C# converter, so this code will be fine.
Regards.
|
|
|
|
|
|
Try this:
public static void CopyFields(object source, object target)
{
if (source == null)
throw new ArgumentNullException("source");
if (target == null)
throw new ArgumentNullException("target");
FieldInfo[] fiSource = source.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
FieldInfo[] fiTarget = target.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
foreach (FieldInfo fiS in fiSource)
{
foreach (FieldInfo fiT in fiTarget)
{
if (fiT.Name == fiS.Name)
{
fiT.SetValue(target, fiS.GetValue(source));
break;
}
}
}
}
Then call CopyFields(a, b) .
|
|
|
|
|
Hi Bhiller,
Thank you soooo much.. Your code will be highly useful for me.
I just checked your code and awesome!! Great !! Thats the solution what I was searching for so loooong time.
Many many thanks.
modified on Friday, August 6, 2010 2:49 AM
|
|
|
|
|
I would cache the information to make repeated calls quicker.
|
|
|
|