|
You don't need to do anything with credentials. If you SQL Server is already setup to handle Windows Authentication, you don't need the credentials. You just need the correct connection string.
Trusted Connection:
Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=SSPI;
Trusted Connection (Alternate syntax):
Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;
These, of course, assume that the user workstations are either in the same domain as the SQL Server or are in a domain that is trusted by the domain the SQL Server is in.
You don't need to modify the connection string at all.
You would also have to setup security in the SQL Server for the users or a group the users would be in to access the database accordingly.
|
|
|
|
|
can someone tell me why stack.takewhile does not pop the items taken?
Stack<int> mystack = new Stack<int>(Enumerable.Range(1, 5));
mystack.TakeWhile(i => i > 3).ToList().ForEach(i => Console.WriteLine(i));
Console.WriteLine(mystack.Peek());
outputs
5
4
5
i would expect the last peek to give me 3. ( obviously i'm missing something but what is it? )
|
|
|
|
|
Why would it? TakeWhile is a LINQ extension on Enumerable. It knows nothing about stacks.
|
|
|
|
|
|
I have created an array list to save my listview settings but cannot seem to figure out how to save it to an a preset setting in my properties. This is what I have so far.
List<string[]> list;
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
list = new List<string[]>();
foreach (ListViewItem lvi in lv.Items)
{
string[] values = new string[] { lvi.Text, lvi.SubItems[1].Text, lvi.SubItems[2].Text, lvi.SubItems[3].Text };
list.Add(values);
}
}
|
|
|
|
|
Read this[^] for information on how it should be done.
Panic, Chaos, Destruction. My work here is done.
Drink. Get drunk. Fall over - P O'H
OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre
I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer
Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
|
|
|
|
|
whats the issue you are facing ?
|
|
|
|
|
hello, my program use socket class to find ip packet info.
My project is related with lan monitoring. Is there any way to use
this class without using manifest file when application install in admin account.
i don't want to use manifest for "requireAdministrator" bcoz app
didn't work when i added it in window startup prgram.
tell me is this possible
thank u for any help.
|
|
|
|
|
Monitoring network traffic (i.e.: using WinPCap) always requires administrivate permissions. I can't think of a situation where it wouldn't.
Put the admin manifest in your project. If it's in the users Startup folder, at worst, it'll ask for permission to run when they login.
|
|
|
|
|
i also think that.....
but i m not confirm.
thank you
|
|
|
|
|
If the WinPCap service is installed and the service is set to SERVICE_AUTO_START then the application will not require administrator credentials. However this is probably irrelevant if the OP is simply putting the network device in promiscuous mode.
|
|
|
|
|
Hi there,
I´m trying to understand how Methods with Predicate and Conditions work; it´s a little confusing for me.
For example, we have a 10-positions array of bytes, such as
public byte[] Client_ID_List { get; private set; }
, it´s initialized by:
Client_ID_List = new byte[8];
After a while, I want to find the first position in this array that has '0' value.
I have seen that First method returns the first element that satisfies a condition, but I don´t really understand how Predicate argument works.
Any help or simple example will be very useful.
Or maybe any other idea to solve this issue.
Kind Regards,
D.
|
|
|
|
|
A predicate is just a method that returns a boolean value. Thus to use a predicate in a .First query, you can either use a Lambda expression
byte FirstZeroByte()
{
return ClientIdList.First((b) => b == 0);
}
or pass a method to the query that returns a boolean
bool IsZeroByte(byte byteToCheck)
{
if (byteToCheck == 0)
return true;
return false;
}
byte FirstZeroByte()
{
return ClientIdList.First(IsZeroByte);
}
Hope this helps
Live for today. Plan for tomorrow. Party tonight!
|
|
|
|
|
Hi guys, I'm currently working on a ship management system. The problem lies in the main bridge between the ships and the server. When there is more than 700 ships, the bridge doesn't send the message to the server in FIFO order, causing the display in the application to appear as jumping back and forth.
After a bit of debugging (and searching of course), I found that the root of the problem is within lock(){} which process data within a list just before sending it to server. There are 10 Threads managing this List, All of them does the same job (The previous version which use just 1 list doesn't have this error but it's very slow and it has a huge memory usage). This is because lock release thread according priority, causing the latest ship data to be sent before the older ship data. I do realize that .net doesn't have any FIFO Lock and I do realize the existence of ConcurrentQueue<t>[^] and other thread safe collection, but this application must run on .net 2.0 (dunno why). So is there any solution to this problem? (It's not necessarily a FIFO Collection , a FIFO Lock will do)
So far, I tried replacing lock with this class:
using System.Threading;
public sealed class QueuedLock
{
private object innerLock;
private volatile int ticketsCount = 0;
private volatile int ticketToRide = 1;
public QueuedLock()
{
innerLock = new Object();
}
public void Enter()
{
int myTicket = Interlocked.Increment(ref ticketsCount);
Monitor.Enter(innerLock);
while (true)
{
if (myTicket == ticketToRide)
{
return;
}
else
{
Monitor.Wait(innerLock);
}
}
}
public void Exit()
{
Interlocked.Increment(ref ticketToRide);
Monitor.PulseAll(innerLock);
Monitor.Exit(innerLock);
}
}
But it doesn't help. In fact, it increases the error percentage from 20% (Simulated with a generator that generate 100.000 ship data) to 23% [Edit:Miscalculation on error count ]
So, does anyone here have an idea on how to solve this? Any ideas will be greatly appreciated.
Excuse me for my improper grammar and typos.
It's because English is my primary language, not my first language.
My first languages are C# and Java.
VB, ASP, JS, PHP and SQL are my second language.
Indonesian came as my third language.
My fourth language? I'm still creating it, I'll let you know when it's done!
modified on Thursday, August 25, 2011 4:56 AM
|
|
|
|
|
|
Um,, I think I use wrong title for my thread. Fixed now.
Nevertheless, I'll try using Queue as described here[^].
[Edit]
Error percentage:6% [Edit2:Miscalculation ]
Well, at least it's better than my solution. Yosh, I'm making progress, thanks
[/edit]
Excuse me for my improper grammar and typos.
It's because English is my primary language, not my first language.
My first languages are C# and Java.
VB, ASP, JS, PHP and SQL are my second language.
Indonesian came as my third language.
My fourth language? I'm still creating it, I'll let you know when it's done!
|
|
|
|
|
It does show you how to lock the queue in the middle of the page.
|
|
|
|
|
Well, yeah. But what I'm looking for is to make a FIFO Lock in .net 2.0. Anyway, thanks, guess I'll experiment a bit more
Excuse me for my improper grammar and typos.
It's because English is my primary language, not my first language.
My first languages are C# and Java.
VB, ASP, JS, PHP and SQL are my second language.
Indonesian came as my third language.
My fourth language? I'm still creating it, I'll let you know when it's done!
|
|
|
|
|
Now you have confused me! You are trying to re-invent the wheel?
QUEUE is FIFO
Look at the section in the link I sent you, it discusses thread safety and locks via a Synchronize wrapper....
Eveything is there for you. Good luck
|
|
|
|
|
DaveAuld wrote: You are trying to re-invent the wheel?
Yes, I got that class from this page[^]. It says that there is no FIFO locks in .net and I have to create my own.
Excuse me for my improper grammar and typos.
It's because English is my primary language, not my first language.
My first languages are C# and Java.
VB, ASP, JS, PHP and SQL are my second language.
Indonesian came as my third language.
My fourth language? I'm still creating it, I'll let you know when it's done!
|
|
|
|
|
Dave is right, a Queue is what you seem to need here. And don't think of it as a QueuedLock, look for a LockedQueue, i.e. a queue that uses a single lock to make it thread-safe. That is bound to keep your data in FIFO order. You can easily build a LockedQueue yourself, or just google the term to find several examples.
|
|
|
|
|
How to register .ocx file with (regsvr32) from code in C# ?
|
|
|
|
|
System.Diagnostics.Process.Start("regsvr32 " + ocxfile_path);
|
|
|
|
|
I did it but says: The system cannot find the file specified
|
|
|
|
|
Use a fully qualified path. Something like this:
string ocxPath = Path.Combine(Application.StartupPath, "myocxfile.ocx");
Process.Start(string.Format("regsvr32 {0}", ocxPath));
|
|
|
|