|
Gareth, thnx for the reply but it isnt working still.......i have included the main codes below, just check thru.........
using System.Data.OleDb;
private OleDbConnection myCon;
public Form1()
{
myCon = new OleDbConnection(@"Provider=Microsoft.JET.OLEDB.4.0;" + @"data source=empDB.mdb");
InitializeComponent();
}
private void Form1_Load(object sender, System.EventArgs e)
{
myCon.Open();
MessageBox.Show("Successfully Connected");
}
And this is the error message which I'm getting :
"An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll"
Thanks
|
|
|
|
|
Gareth, i got the solution.........i entered the full path and it worked.........and this is for ur info.......tek care.............happy coding............
Thanks
|
|
|
|
|
hi verghese,
Try this
1. If you are using standard security
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\dbsample.mdb;User Id=admin;Password=;
2. If you are using a password for your access file
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\dbsample.mdb;Jet OLEDB:Database Password=MyDbPassword;
regards
|
|
|
|
|
Good job Sujith.........tht was the problm with the path.......i gave the full path and it worked........thanx a lot..........bye
Thanks
|
|
|
|
|
I read the MSDN documentation on System.Windows.Forms.Application.SetCompatibleTextRenderingDefault (bool), and I still don't understand why I need it and what it does. I've passed true and false for different programs (not remembering which to use) and I don't see a difference.
|
|
|
|
|
Basically, it specifies whether GDI or GDI+ is used under the hood. Setting it to false will use GDI and should look better and localize better.
All it does is set the default value for Control.UseCompatibleTextRendering. But it gets overrided for a particular control if you set someControl.UserCompatibleTextRendering to a different value.
Put a label on a form and set, through code (not the designer) the label.UseCompatibleTextRendering property. Try setting it to true and false. On flatscreen monitors, it definitely is easy to spot -- without it, text looks jaggy and rigid. Set it to false, and it looks nice and smooth.
Life, family, faith: Give me a visit.
From my latest post: "And you think, 'To keep my anti-Judaic theology alive I must reinterpret this verse too as being a blessing for Christians and not for Jews. I know it strains all manner of principles of interpretation. I don’t read the newspaper this sloppily, but, man, I have a theology to defend.'"
Judah Himango
|
|
|
|
|
So I should pass in false to SetCompatibleTextRenderingDefault (bool)? It basically sets anti-alaising (spelling)?
|
|
|
|
|
Yes, try false and see how it works out for you.
Life, family, faith: Give me a visit.
From my latest post: "And you think, 'To keep my anti-Judaic theology alive I must reinterpret this verse too as being a blessing for Christians and not for Jews. I know it strains all manner of principles of interpretation. I don’t read the newspaper this sloppily, but, man, I have a theology to defend.'"
Judah Himango
|
|
|
|
|
I am reading data from a datafile and comparing it to a literal string. What is puzzling is that no matter what data I read from the data file for the variable "username", the boolean expression
(username == "lexsystem")
evaluates to "true", as if every string matches.
I tried "==", and ".Equals", and "Compare" and all give the same result.
Help!
Here is my code
--------------------------------------------------------------------------
private void btnSubmit_Click(object sender, EventArgs e)
{
FileStream file = new FileStream("LexPassword.txt", FileMode.Open, FileAccess.Read);
StreamReader reader = new StreamReader(file);
string username = reader.ReadLine();
string password = reader.ReadLine();
MessageBox.Show(username);
//MessageBox.Show(password);
//MessageBox.Show(Convert.ToString(txtUsername));
//MessageBox.Show(Convert.ToString(txtPassword));
if (username == "lexsystem")
{
Hide();
LexSystemfrm Form1 = new LexSystemfrm();
Form1.ShowDialog();
Close();
}
else
MessageBox.Show("Invalid Login, Please Enter the Correct Information");
----------------------------------------------------------------------
|
|
|
|
|
Jerry Graham,
Works fine for me. Also, it would be a good idea to use the "using" syntax around the FileStream and StreamReader so it gets disposed correctly.
Regards,
Gareth.
(FKA gareth111)
|
|
|
|
|
hi.. i have a question related to the listview.. i did the below things.. but how do i assign the value to the listview /?
void call_listview()
{
cmd.Connection = con;
cmd.CommandText = "select * from contact";
da.SelectCommand = cmd;
DataTable store = new DataTable();
try
{
ds.Clear();
con.Open();
da.Fill(ds);
store = ds.Tables[0];
int count_friend = store.Rows.Count;
contact_total_friends.Content = count_friend;
contact_listview.DataContext = ds.Tables[0].DefaultView;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
con.Close();
}
}
|
|
|
|
|
Have you looked at any articles on this site regarding ListView databinding? A quick search reveals Data binding a ListView[^]
Life, family, faith: Give me a visit.
From my latest post: "And you think, 'To keep my anti-Judaic theology alive I must reinterpret this verse too as being a blessing for Christians and not for Jews. I know it strains all manner of principles of interpretation. I don’t read the newspaper this sloppily, but, man, I have a theology to defend.'"
Judah Himango
|
|
|
|
|
I am trying to copy part of a large bit array to another in one step like you can with a byte array and Array.ConstrainedCopy() but aparently you can not use that function with bit arrays. I have also tried Buffer.BlockCopy() and still no dice. I have done some googling and didn't find what I'm looking for. Does anyone know how to do what I want without copying bits out one at a time?
Argument '1': cannot convert from 'System.Collections.BitArray' to 'System.Array'
|
|
|
|
|
I'm not sure how to do this with a BitArray, short of doing a foreach and copying the elements you want.
Instead of BitArray, could you just use a List<bool> or a bool[]?
Life, family, faith: Give me a visit.
From my latest post: "And you think, 'To keep my anti-Judaic theology alive I must reinterpret this verse too as being a blessing for Christians and not for Jews. I know it strains all manner of principles of interpretation. I don’t read the newspaper this sloppily, but, man, I have a theology to defend.'"
Judah Himango
|
|
|
|
|
The functionality to copy a segment of a BitArray into another BitArray probably got prioritized away at the design stage.
I partially support that decision, for these reasons:
- The operation could be surprisingly expensive. In case you specified a start index not a multiple of the underlying byte/ushort/uint/ulong type used for packing the bits, it could potentially take lots of shifting and oring to do the job (depending on size - but as the type is there to make huge bit arrays more compact, the size would usually be significant). I don't think the CPU blitting support can handle that kind of operations, so the framework would have no way of optimizing it under the hood.
- The expensiveness of the operation would be nondeterministic. You have no way of knowing what the underlying storage is, and it may change from platform to platform (I would guess that the 32-bit framework uses UInt32 and the 64-bit uses UInt64), so you could never optimize it yourself.
For the exact same reasons, Buffer.BlockCopy() would be useless.
However, I find it strange that the CopyTo() method doesn't have an overload that lets you specify source start index and count. The existing version should be just as expensive as a "segmentized" version... go figure!
If you really need it - write your own CustomBitArray clone - the stuff it does isn't all that complicated... If you were to make the starting bit offset into the first word (of whatever length you use) variable (as in a private member keeping track of it), you could implement a fast segment cloner using Buffer.BlockCopy() (it would copy the words involved and adjust start offset and length of the newly created destination array). Copying a segment into a segment of a preexisting CustomBitArray wouldn't be optimizable, though.
--
Peter
|
|
|
|
|
That is what I was afraid of. I suppose it is not common to use a BitArray that is several hundred K in size and read 1K chunks out more or less at random. I suppose this is not all that bad...
BitArray ReturnArray = new BitArray(LENGTH);
for (int i = 0; i < LENGTH; i++)
{
ReturnArray[i] = iIndexer[POS + i];
}
return ReturnArray;
|
|
|
|
|
Hey All,
I'm working on Multi language application, which supports around 22 languages.
The problem is how do I show standerd "Open File", "Save" and "Print" Dailogue in other languages ?
Thanks in Advance...
|
|
|
|
|
The common dialogues will automatically be displayed in the operating systems language.
Simon
|
|
|
|
|
Currently, I am working on a Web project that retrieves it's many, sometimes 1000+, records from the SQL database and stores them into Generic lists of objects. The project also is using .NET framework caching for storing much of the same SQL data returned and other web data. In my opinion this is doing double storage. Is there something I'm missing and which is the better way to go?
Thanks,
Steve
|
|
|
|
|
Your missing the fact that Db retrieval is quite heavy and retrieval from the Server's memory (which is where the "cache" is) is very quick.
|
|
|
|
|
This is something that confuses me. When I retrieve records, I use a reader to add objects to generic lists. Is what you are saying is that the retrival should be done directly into the cach and then fill the generic lists from there? If this is the case, should I be filling datatables directly to cach, and when needed, fill the generic lists at that point?
Thanks,
Steve
|
|
|
|
|
You are missing the point. When you get the data from the database, you only store it in the cache for later use. You get the gain later, when you can get the data from the cache instead of calling the database again.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
See, what I don't understand is this, getting the data from the database and storing it into generic list of objects seem to serve the same purpose as going from the database directly to cach. The point is that I am designing a system. Now, what I am thinking is, for example, having a PatientManager object which stores a generic list of Patient objects. In the PatientManager should I get the list of Patient objects directly from the database and not use cach or should I have both a cach table in the PatientManager object and load the generic list of Patient objects as needed? I need advise before I start with the UML.
Very much thanks for the help!
Steve
|
|
|
|
|
Steve Holdorf wrote: I am working on a Web project
So what to do you intend to use as the scope of this PatientManager instance? Unless you put it in the Application or Session memory you will have to load it for every request which is where the cache comes into play. Get it?
led mike
|
|
|
|
|
Sorry for being such a pain in the A##. The way I think the design should be laid out is that there is only one static PatientManager. Now this PatientManager calls a DAO object for SQL/DB access and the DAO object would return either a Generic List of the Patinet (instance objects) or the DAO should return a complete DataTable for cach. First question is which would you do? Now, if it returns a DataTable to cach then I think when data binding, sorting, etc. is needed the PatientManager should load the Generic list from the PatientManager's cach datatable thus not having to hit the database again. Does this way sound better using the cach DataTable storage and not re-hitting the database or the first way, using the Generic List, without cach, for storage and not re-hitting the database.
Again sorry for being a dummy and any help in getting a concrete design would be great.
Steve
|
|
|
|