|
Change this line
private sealed class struc to
internal sealed class struc
The error is because you defined the the class struc as private and using it outside through internal at this line
internal static struc[] arrStruc = new struc[]
|
|
|
|
|
It's not exactly a complicated error message: the class AndroidApplication18.Farsi.struc[] is marked as private , and both AndroidApplication18.Farsi.arrStruc and AndroidApplication18.Farsi.arrStrucWoosim are marked as internal .
Things which are internal are available to more code than those which are private ; hence the "Inconsistent accessibility" error.
Either make the class internal , or make the fields private .
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
The issue is that since class struc is private the only from within the class Farsi can the member fields of struc be accessed. However, arrStrucWoosim is declared internal , which is like public except restricted to the same assembly. So, any method/property of any class within the same assembly can access the Farsi.arrStrucWoosim array, they will not be able to access any of the fields of the values of that array.
|
|
|
|
|
Hi All,
am using [DllImport("NetApi32.dll", SetLastError = true, CharSet = CharSet.Unicode)] to access, save files to a network location. The problem is File creation / save work fails for first few attempts and laters starts working fine. After a time interval say 5-6 hours again it fails first few time. Kindly help
Thanks in advance
|
|
|
|
|
shoab.shah wrote: Kindly help OK, but unless you show a bit of your code and the exact error details, we cannot begin to guess what may be happening.
Use the best guess
|
|
|
|
|
Hi this is the error i get when saving file on the network location
FileStream was asked to open a device that was not a file. For support for devices like 'com1:' or 'lpt1:', call CreateFile, then use the FileStream constructors that take an OS handle as an IntPtr.
|
|
|
|
|
That seems quite clear; so what is your problem?
Use the best guess
|
|
|
|
|
It's that invisible code that you are using that's causing the problem.
|
|
|
|
|
Am using Docx.dll its a open source dll from code plex
of it am using SaveAs(path) function
over here it gives exception
|
|
|
|
|
I don't know how much clearer I can make this, but show us your actual code. Giving us a part of a command here or a definition there doesn't cut it. You are just wasting your time and ours until you actually show us your code. It doesn't need to be all your code - just show us the code that isn't working.
|
|
|
|
|
Here is a part of code
string FAXFilePrefix = Helper.Helper.GetConfigValue("FAXFilePrefix");
string domainName = System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().DomainName;
string location = GetLocalStoragePath() + FAXFilePrefix + requestViewModel.encounter.ServiceEncounterID + "_" + uniqueId.ToString() + ".docx";
MvcApplication.TraceSource.TraceEvent(TraceEventType.Information, 100, "Before Accessing UNC path ");
using (Carena.PCHA.CoreServices.UncPath.UNCAccessWithCredentials unc = new Carena.PCHA.CoreServices.UncPath.UNCAccessWithCredentials())
{
if (unc.NetUseWithCredentials(Path, userName, domainName, Password))
{
MvcApplication.TraceSource.TraceEvent(TraceEventType.Information, 100, "Before docx.SaveAs ");
MvcApplication.TraceSource.TraceEvent(TraceEventType.Information, 100, "Location - "+location);
try
{
docx.SaveAs(location);
}
catch (Exception ex)
{
loggerl.LogException(ex);
}
MvcApplication.TraceSource.TraceEvent(TraceEventType.Information, 100, "After docx.SaveAs ");
}
It throws exception at docx.SaveAs(location); line
|
|
|
|
|
I don't see anything in there to do with this DllImport code though. Is this what's happening inside this docx component? If so, I suggest that you should raise it on the support forum for that component.
|
|
|
|
|
|
Given that you have provided even less information than posted here, I would be surprised if you see anything. Why not use your debugger to diagnose the exact situation at the point of failure and then provide all the information that you have, so someone can try and help you?
Use the best guess
|
|
|
|
|
OK, so what's the EXACT contents of location when it fails??
|
|
|
|
|
\\remote comp ip\foldername\filename.docx which is correct
|
|
|
|
|
That's not the EXACT contents. That's just the format you expect it to be in when this code runs.
|
|
|
|
|
Its true that what i have shown is format. But i can't show the actual path. The path i get is as expected
|
|
|
|
|
Oh well, I guess you're on your own now, because the problem seems to be with that path.
|
|
|
|
|
In a C# 2010 desktop application I am using a linq to sql statement to compare a C# datetime field to a sql server 2008 r2 datetime field. By doing this comparison I am getting inconsistent results. Thus I am guessing a C# datetime field is not the same as a sql server 2008 r2 datetime value.
Thus for this comparison to work, I would like to know how to change a C# datetime field to a sql server date time field. I would think I would need to do this conversion prior to comparing the dates.
Thus now you show me code and/or point me to a reference that will show me how to solve this problem?
|
|
|
|
|
The problem is most likely down to the fact that you aren't actually testing what you think you are. The DateTime object has milliseconds associated with it, so if you forget to take those into account, you'll find that you don't get a match.
|
|
|
|
|
hey it is very easy ist in C# hand take string variable instead of taking datetime variable for datetime value..
and at the back end convert it by using convert(datetime,@variable,103) where u r inserting deleting or updating
|
|
|
|
|
He's looking for details on how to do this in Linq though. Perhaps you might want to address this - plus, you shouldn't use a string if what you mean is a date. There is far too much risk, using a string, that you will end up with date conversion issues because of locales.
|
|
|
|
|
I want to compare to see if sql date > minimum date (1/1/1753) and sql date < current today
|
|
|
|
|
Something like this should do it
DateTime minDate = DateTime.ParseExact("1753/01/01, "yyyy/MM/dd", CultureInfo.InvariantCulture,DateTimeStyles.None);
var result = (from p in ctx.SomeTable
where p.MyDate > minDate && p.MyDate < DateTime.Now
select p).ToList();
|
|
|
|