|
Do you want to have all the records in memory at once? Or do you want to read each particular record based on its ID or SN (e.g. GetRecord ( 7 ) )?
What are you going to do with the data?
|
|
|
|
|
hello everybody
I write one c# program for reading data record from an access database ant write each record to one line in text file and now I want to read data from each line in text file and show them on a form using labels or text boxes etc to check that the data on text file are equal to database records or not?
I am sorry if i can't describe as well as you want .
|
|
|
|
|
Why not have the application that displays the data also get the data from Access? It's really not a difficult task.
|
|
|
|
|
how do i change the filter to only give me users in my group i tryied memberOf='CN=GMDPortal,OU=IT,OU=ADM,DC=corp,DC=com' but it does not work i need to use a directorysearcher because i need to set search.PageSize = 4000; i have 3,000 users in this group
public static ArrayList GetAllADDomainUsers()
{
string domainpath = @"LDAP://DC=corp,DC=com";
ArrayList allusers = new ArrayList();
DirectoryEntry searchRoot = new DirectoryEntry(domainpath);
DirectorySearcher search = new DirectorySearcher(searchRoot);
search.Filter = "(&(objectCategory=person)(objectClass=user)(memberOf='CN=GMDPortal,OU=IT,OU=ADM,DC=corp,DC=com' )(!userAccountControl:1.2.840.113556.1.4.803:=2))";
search.PropertiesToLoad.Add("samaccountname");
search.PropertiesToLoad.Add("distinguishedName");
search.PropertiesToLoad.Add("description");
search.PropertiesToLoad.Add("displayName");
search.PropertiesToLoad.Add("pwdLastSet");
search.PropertiesToLoad.Add("whenChanged");
search.ReferralChasing = ReferralChasingOption.All;
search.PageSize = 4000;
SearchResult result;
SearchResultCollection resultCol = search.FindAll();
user ousr = new user();
if (resultCol != null)
{
for (
int counter = 0; counter < resultCol.Count; counter++)
{
result = resultCol[counter];
if (result.Properties.Contains("distinguishedName"))
{
ousr = new user();
ousr.dn = (string)result.Properties["distinguishedName"][0];
try
{
ousr.Description = (string)result.Properties["description"][0];
}
catch (Exception er)
{
ousr.Description = " ";
}
try
{
ousr.DisplayName = (string)result.Properties["displayName"][0];
}
catch (Exception er)
{
ousr.DisplayName = (string)result.Properties["samaccountname"][0];
}
try
{
ousr.pwdLastSet = DateTime.FromFileTime((Int64)result.Properties["pwdLastSet"][0]);
}
catch (Exception er)
{
ousr.pwdLastSet = DateTime.MinValue;
}
try
{
ousr.whenChanged = (DateTime)result.Properties["whenChanged"][0];
}
catch (Exception er)
{
ousr.whenChanged = DateTime.MinValue;
}
ousr.usersname = (string)result.Properties["samaccountname"][0];
allusers.Add(ousr);
}
}
}
return allusers;
}
}
public class user
{
public string dn;
public string usersname;
public string Description;
public string DisplayName;
public DateTime pwdLastSet;
public DateTime whenChanged;
}
|
|
|
|
|
I did a project on windows in c #.net and when i opened the project after some days it is showing "Could not find type 'CrystalDecisions.Windows.Forms.CrystalReportViewer'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built".
|
|
|
|
|
Assuming that you have tried fully building the project, what changes had you made to your PC between when it worked, and when it didn't?
BTW: Your subject may be descriptive, but try cutting it down - "Could not find CrystalReportViewer" would be better than typing you question twice, one in the subject and once in the body...
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
"Rumour has it that if you play Microsoft CDs backwards you will hear Satanic messages.Worse still, is that if you play them forwards they will install Windows"
|
|
|
|
|
What kind of subject is that!
The error means you need to add a reference to the required library. You need to learn how to use Visual Studio (assuming that is what you are using) - thus you shouldn't really be asking in this forum.
Just do the same thing you did when you first created the project some days ago.
Life goes very fast. Tomorrow, today is already yesterday.
modified on Wednesday, November 18, 2009 10:02 AM
|
|
|
|
|
Add reference to the crystal reportviewer dll.
Just open the References Tree in the Solution explorer, delete the one which is in Yellow Exclamation Sign, and add it again.
Your Subject line should be something else than the body. Atleast a gist of the body.
|
|
|
|
|
|
mehrdad333 wrote: i want to connect two or more webcams to program
Try asking the person who wrote the program you are using.
mehrdad333 wrote: its vital
Vital for what?
|
|
|
|
|
Hi All, I need to know how many rows I have in a table where x condition meets, in sqlite database.
I want to print it on the screen, how do I do it.
"SELECT SUM(Call)FROM Hall_Call_Up WHERE Car = 3"
In other words, count the rows that are certain category and display on sreen.
Thanks
|
|
|
|
|
Use Count in stead of sum
SELECT COUNT(*) FROM Table WHERE Condition
|
|
|
|
|
Eduard, thanks much for your answer. Can you please tell how do i get that value and print it.
for example given condition meets 200 rows. how do I get that 200 and display it on the screen.
thanks a lot.
|
|
|
|
|
Do you already have a connection to the database?
object oRowCount = Command.ExecuteScalar();
int iRowCount = (oRowCount == null) ? 0 : int.Parse(oRowCount.ToString());
|
|
|
|
|
I don't know what do you mean by condition but this is what I have Or I am doing.
(I am very new to database. I get done most of it but I have problems here and there).
con = new SQLiteConnection(@"Data Source= MyData.db;Version=3;New=False;Compress=True;");<br />
con.Open();<br />
cmd = new SQLiteCommand();<br />
cmd = con.CreateCommand();<br />
cmd.Connection = con;<br />
cmd.CommandText = "SELECT COUNT(Call)FROM Hall_Call_Up WHERE Car = 3";
I don't know if this is make sense to you or Not.
thanks again.
|
|
|
|
|
I did not say 'condition', I said Connection
After the cmd.CommandText paste this code :
object oRowCount = cmd.ExecuteScalar();
int iRowCount = (oRowCount == null) ? 0 : int.Parse(oRowCount.ToString());
|
|
|
|
|
jashimu wrote: COUNT(Call)
COUNT(Call) and COUNT(*) are two different things; are you sure you want COUNT(Call)?
|
|
|
|
|
Eduard, Thanks it work for me. that is all I needed.
thanks again for your help.
|
|
|
|
|
Eduard Keilholz wrote: int.Parse(oRowCount.ToString()
That is entirely inefficient -- I hope you don't write production software that way. The value is already an int; you just need to tell the compiler that it is by casting it. Never turn a value into a string and then parse it right back to the type that it was.
And, in this case (counting records), the value will never be null* (though it may be zero); so you needn't check for that.
int iRowCount = (int) Command.ExecuteScalar() ;
* Something is tickling the back of my brain saying that this is an untrue statement, but I can't remember in what circumstances I've run into trouble before. So I'll say it and maybe someone else will remind me.
|
|
|
|
|
I am not an expert in sql so I listen who ever says anything and works That is all I care fore, at least now. But I will try what you just said.
Eduard code worked for me but I don't know it is not a best option that only experts know.
thanks for your feedback.
|
|
|
|
|
I've got SQL 2005 Express and db located on server. Clients computers connect to it and server application also connect to db to perform SQL queries.
How to enable simultanious access to db?
If server connected to db, it remains unavailable for connections from client with error:
System.Data.SqlClient.SqlException in Void OnError(System.Data.SqlClient.SqlException, Boolean): Cannot open user default database. Login failed.
Login failed for user 'NT AUTHORITY\SYSTEM'
Or vice versa, if client connected to db and read some date, server can not connect to it for some period of time
Чесноков
|
|
|
|
|
This is not an error with simultaneous connections but rather with authentication.
There is no limit on the number of connections in SQL 2005 Express.
|
|
|
|
|
Make user accounts and associate with a login.
I think it supports multiple users if not the database is altered as Single User.
|
|
|
|
|
I'm not versed in SQL server management.
When I created database in VS it gave default connection string which I'm using:
Data Source=.\SQLEXPRESS;AttachDbFilename=C:\dbs\MyDatabase.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True"
I've got SQL 2005 express and managment tools.
How to add those users and change connection string param?
Currently, single applicaion engages db file resulting in:
System.Data.SqlClient.SqlException in Void OnError(System.Data.SqlClient.SqlException, Boolean): Cannot open user default database. Login failed.
Login failed for user 'NT AUTHORITY\SYSTEM'.
Until application is closed or some period of time elapses, MyDatabase.mdf becomes engaged as you neither can not delete it nor open.
How to manage that multiple clients connections to single db?
Чесноков
|
|
|
|
|
It is an authentication issue. Why is your app trying to connect as SYSTEM user ? Are you trying to connect from a windows service ? Whatever the case may be, if you are using Windows Authentication, ensure that the user is trusted with SQL Server or use SQL Server authentication.
|
|
|
|