|
Mark Salsbery wrote: Could that be an issue?
Nope. It could be a paradox: when warned like that, there no longer is anything not to expect.
|
|
|
|
|
Your specific problem has been identified, however I would suggest you have a greater problem in the design of the UI part of your application.
I cannot imagine any scenario where it would be useful to any user that so many columns are displayed. Better to provide a means for the user to select to dispay differing subsets of the data so they can view what is relevant easily than to swamp them with so much data that requires endless scrolling IMO.
|
|
|
|
|
Very true. I mean displaying hundres of columns is just insane IMHO.
All the best,
Dan
|
|
|
|
|
Why would you want to display 310 columns?
|
|
|
|
|
Hi All !
I have Two ComboBox(With Their Items) And I Want to add These Items to A ListView in Two Column .
How can i do it?
thx for any reply !
|
|
|
|
|
Iterate the items in the ComboBox controls (I am assuming they both have the same number of items), create a ListViewItem, set its text and sub-item text and add it to the ListView.
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
We have an asp.net web application running in both .net 1.1 and 4.0. This application has a web.config file in the root folder where the authorization module is defined as
<authorization>
<allow users="*"/>
</authorization>
It has another web application in the sub directory where the web.config authorization module is as below
<authorization>
<allow roles="some valid role"/>
<deny users="*"/>
</authorization>
These configuration settings work fine in .net 1.1 but after migration to .net 4.0, the application is causing problems in providing appropriate access.
Is there any difference in reading the authorization module tags(<allow>,<deny>) of web.config of an application in .net 4.0 and 1.1 ?
|
|
|
|
|
They are using different authorizations schemes - the root authorization is user based only - the other requires a RoleProvider as well. Check you have an appropriate RoleProvider configured, and that the described role is enabled.
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
The role access is checked for the logged in user, for whom the roles are defined in the database. There has been no change in the database neither in the role definition nor the access to the users. The problem is caused only after migration of the web application from 1.1 framework to 4.0 framework.
|
|
|
|
|
Perhaps you would like to ask this in the ASP.NET forum then. You are more likely to get an answer there.
|
|
|
|
|
hi i have a custom authentication used from
http://brianlegg.com/post/2011/05/09/Implementing-your-own-RoleProvider-and-MembershipProvider-in-MVC-3.aspx
i need to show a list of online users , can anyone help
|
|
|
|
|
A couple of thoughts;
As this is an ASP.NET issue, this should at least be asked in that forum rather than here.
Perhaps the author of the original code could help you. He's probably better placed to help you based on his code.
|
|
|
|
|
How I can dicipher a file with triples DES without Error, puisque j'ai essayer mais je récupér un texte en plus a la fin du fichier de sortie (la derniére ligne répéter), alors j'ai assurrer que c'est le dernier block et sachant que j'ai utilisé le formatage PKCS#7 et le mode CBC.
|
|
|
|
|
|
Think's JF2015 I'm succed to cipher ad decipher my data think you , my problem it was the file in input damaged , when i change the input file all was working good...
|
|
|
|
|
Greetings, you managed to insult both english and french languages in the same post...
No memory stick has been harmed during establishment of this signature.
|
|
|
|
|
Greetings Gurus,
Could you offer some advice/help please?
I am trying to read a SQL db for a specific value and add it in if not found. I have more-or-less got the procedure working but the DataReader recognises that the value exists then goes and adds it back in twice anyway.
try
{
string c = System.Environment.MachineName;
string Domain = System.Net.Dns.GetHostName();
ManagementObjectSearcher SerialNo = new
ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM
Win32_SystemEnclosure");
foreach (ManagementObject querySN in SerialNo.Get())
{
string SN = (querySN["SerialNumber"].ToString());
string SysIdent = c + SN + "@" + Domain;
SqlConnection conn1 = new SqlConnection("User id = a;
password = b; server=c; database=d;connection timeout=30");
SqlCommand selectname = new SqlCommand("SELECT FullName
FROM dbo.tablename", IdentSys);
IdentSys.Open();
SqlDataReader GetIdnt = selectname.ExecuteReader();
while (GetIdnt.Read())
{
string Names = Convert.ToString(GetIdnt["FullName"]);
{
if (Names != SysIdent)
{
SqlConnection conn2 = new SqlConnection("User id = a;
password = b; server=c; database=d;connection timeout=30");
SqlCommand newname = new SqlCommand("INSERT
INTO dbo.SysIdent(FullName) VALUES(@FullName)", InsertSys);
newname.Parameters.AddWithValue("@FullName",SysIdent);
InsertSys.Open();
newname.ExecuteNonQuery();
InsertSys.Close();
}
}
}
GetIdnt.Close();
}
}
catch (Exception f)
{
Console.WriteLine(f.ToString());
}
Could you advise what I am doing wrong please?
|
|
|
|
|
You should read all the Names in a List and if the List doesn't
contains the SysIdent value then add it.
A DataReader can't possibly add anything to the DB.
All the best,
Dan
|
|
|
|
|
Hi Dan,
I am aware that the datareader can't add the value, it was in there to illustrate what I'm trying to do
I'm not quite with you on your other statement though. Do you mean create a list<>Names = new list type of thing? If so, how?
|
|
|
|
|
Look at Lucs post below. About the logic, he explaind it I'm lazzy.
Create a List<string> add each item to the list in the while(reader.Read()) loop,
close the reader, check if the list contains what you wan't and if not add it.
Or do it direclty from SQL, eg check the number of rows where YourField equals what you want.
If the affected rows is 0 then it doesn't exist and you can add it. It should be faster.
All the best,
Dan
|
|
|
|
|
There is a flaw in the logic, your DB operations are equivalent to this:
foreach(record in records) {
if (record!=whatWeWant) insert(newRecord);
}
where it should be:
bool exists=false;
foreach(record in records) {
if(record==whatWeWant) exists=true;
}
if (!exists) insert(newRecord);
Now the existance can be checked without an explicit loop, try an SQL statement akin to this:
SELECT COUNT(1) FROM dbo.tablename WHERE FullName = @ValueWeSearch
which you should run through an ExecuteScalar() operation; the COUNT function makes it return one number, the number of matching records; when 0 insert, otherwise don't.
[EDIT] fixed typo [/EDIT]
modified 21-Nov-11 11:05am.
|
|
|
|
|
Luc & Dan,
Thank you very much for pointing out the trees
SqlCommand selectname = new SqlCommand("SELECT COUNT(*) FROM dbo.SysIdent WHERE FullName = @SysIdent", IdentSys);
selectname.Parameters.Add("@SysIdent", SqlDbType.NVarChar, 150);
selectname.Parameters["@SysIdent"].Value = SysIdent;
IdentSys.Open();
selectname.ExecuteNonQuery();
int Count = Convert.ToInt32(selectname.ExecuteScalar());
if (Count == 0)
{
}
|
|
|
|
|
Almost.
1. COUNT(1) is better than COUNT(*) as the latter may get confused by possible NULL fields (in any field of the record) whereas the former really counts matching rows.
2. Your ExecuteNonQuery() is totally redundant.
3. Your Convert.ToInt32() can be simplified to a simple cast using (int)
|
|
|
|
|
Luc Pattyn wrote: 3. Your Convert.ToInt32() can be simplified to a simple cast using
(int)
|
|
|
|
|
Thanks Luc & PIEBALDconsult, as always, your time spent educating us newbs is appreciated
|
|
|
|