|
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
you have two for loops, only one of them is commented out.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
misCafe wrote: while (sReader.Read() == true)
{
_ID.Add(sReader[0].ToString());
for (int i = 0; i < _ID.Count; i++)
//for (int i = 0; i < sReader.FieldCount; i++ )
{
lstItems = new ListViewItem((i + 1).ToString());
lstItems.SubItems.Add(sReader[1].ToString());
lstItems.SubItems.Add(sReader[2].ToString());
lstItems.SubItems.Add(sReader[3].ToString());
lstItems.SubItems.Add(sReader[4].ToString());
lstItems.SubItems.Add(sReader[5].ToString());
this.lsv_user.Items.Add(lstItems);
}
}
With that, you are adding the same record to the ListView n(sReader.FieldCount) times. Your problem is the line in bold, you are adding the same ID/name ((i + 1).ToString() ) for each record. Each ListViewItem should have a different name or be blank (no parameter).
I think I know what you are trying to do, so I hope this helps:
if (sReader.FieldCount > 0)
{
_ID.Add(sReader[0].ToString());
lstItems = new ListViewItem(sReader[0].ToString());
for (int i = 1; i < sReader.FieldCount; i++)
{
lstItems.SubItems.Add(sReader[i].ToString());
}
this.lsv_user.Items.Add(lstItems);
} You just need to replace the content of your while loop.
My failometer is detecting vast quantities of FAIL!
"Its SQL - hardly programming..." (Caslen)
|
|
|
|
|
Thank you very much again.
I understand what you said and it is solved now.
Chuon Visoth
Angkor Wat - Cambodia
asp.net - c sharp beginner
|
|
|
|
|
hi guys,
in the setup project i added checkboxes dialog to user interface section. i have two checkboxes to install two products accordingly.
if the user unchecks the both of the checkboxes, i want the next button to be disabled.
do you know how to do that?
thanks
|
|
|
|
|
Is there anyway to do this without closing/reopening the file?
I found this in some code I wrote a few years, and after cringing and hitting google, failed to do so.
m_fsXMLLib = new FileStream(m_fileName, FileMode.Create, FileAccess.ReadWrite, FileShare.None);
m_fsXMLLib.Close();
m_fsXMLLib = new FileStream(m_fileName, FileMode.Open, FileAccess.ReadWrite, FileShare.Read);
My intent is to keep anyone from trying to read the file while it's being written and in an inconsistent state. After saving the file, I want it kept open to prevent anyone else from being able to modify it while letting them have read only rights.
It is a truth universally acknowledged that a zombie in possession of brains must be in want of more brains.
-- Pride and Prejudice and Zombies
|
|
|
|
|
Hi Dan,
interesting question.
IMO a pure .NET solution does not exist. This is what I would try:
- create the FileStream with Share.None
- write and flush the data
- now P/Invoke to CreateFile, specify Share.Read and a zero FileMode (which .NET compiles but refuses to run) as explicitly allowed here[^]
- finally close the original FileStream.
That may run all right and yield a file readable for others.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Thanks, I'll give it a shot when I get back into the office on tuesday.
It is a truth universally acknowledged that a zombie in possession of brains must be in want of more brains.
-- Pride and Prejudice and Zombies
|
|
|
|
|
I am writing a web application that I want to use windows authentication for. The only problem is that the users using it may not always be running it from there own machine. I want to check the roles for the current windows user and if they have the required role take them directly into the application. If the current user does not have the required role I will take them to a sign-on page so they can enter their windows user i.d. and password. Then I will check if that user has the required role. The problem is that I can only find a way to check the roles for the current windows user.
Is there a way to validate the user that signs in to the application rather than the windows user and check the roles or groups they are in?
Thank you
Marty
|
|
|
|
|
Use the techniques from this article to impersonate the user given their username and password. Create a new System.Security.Principle.WindowsIdentity object from the token you'll get back from LogonUser. Use my code from this post, where currentPrinciple is the WindowsIdentity you created
|
|
|
|
|
Thank you, I will try this as soon as possible.
Marty
|
|
|
|
|
Thank you this helped greatly.
Marty
|
|
|
|
|
Hi, i want to create an application that can be loaded into anyone computer.. But the database has to be consistent, so i was thinking of using my web server mysql database.
but how do i use the database from the application i created?
|
|
|
|
|
Use a webservice to communicate with the database and have some sort of authentication system for your client.
|
|
|
|
|
can give me some idea of what web service?
|
|
|
|
|
|
dont quite understand..
anyway can use mysql connection string? den replace localhost with my server ip?
|
|
|
|
|
check out this site[^] as it's the leader with connectionstrings, but yes that's pretty much it.
|
|
|
|
|
how do work program database in c# with sql server
|
|
|
|
|
Go buy a book on basics, a forum post can't nearly cover this topic.
|
|
|
|
|
|
Hi There,
Any code snippet in C# on how i can insert a string value in a ByteA column in PostGreSQL ?
Reagrds,
X
Yeee
|
|
|
|
|
in VB . a class can have constructor and funstion or sub. so how to create a function return a value in C# class ?
|
|
|
|
|
you lazy little *&^@!
use google[^]
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
musefan wrote: you lazy little *&^@!
lol! +5
|
|
|
|