|
If you break out that code and look at what it generates, it's fairly obvious what the problem is likely to be:
Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
AssemblyName nm = a.GetName();
string s = nm.CodeBase;
string p = System.IO.Path.GetDirectoryName(s);
AssemblyName.CodeBase returns a value of the form:
file:///D:/Folder/Application.EXE Which GetDirectoryName truncates to:
file:///D:/Folder
The chances are that the SqlCeConnection class does not like that. Try:
System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) instead.
|
|
|
|
|
hi
the code not Working
Error
Format of the initialization string does not conform to specification starting at index 0.
|
|
|
|
|
So check the generated string and copy and paste it in here so I can see what it is.
|
|
|
|
|
Kindly Check Screenshots first
http://i.stack.imgur.com/VcKux.png[^]
http://i.stack.imgur.com/jSPwD.png[^]
Hi All,
I want to have a single project which holds the DataSchema files like EDMX files.
The problem which i am facing is if i create a reference of the PRJDataSchema Project project and try to query the EmployeeEntity i get a "type used in a using statment must be implicitly convertible to 'System.IDisposable'"
How can i resolve this problem.
If i create a class file in PRJDataSchema , like i have created a Test.cs file then i get no problem.
I want to fix the problem in screenshot 1.
any help would be appreciated.
Exploring the Unexplored.
|
|
|
|
|
Issue solved by manually adding reference of "System.Data.Entity" to PRJDataAccess and then add it as using System.Data.Entity to the EmployeeDAL.cs.
Stupid me.
Exploring the Unexplored.
|
|
|
|
|
Have an upvote for posting your own answer.
The admission of stupidity is something we all have to make at some time.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I can't tell you the number of times the answer to a vexing problem has come to me the instant I clicked on the submit button!
I don't speak Idiot - please talk slowly and clearly
"I have sexdaily. I mean dyslexia. Fcuk!"
Driven to the arms of Heineken by the wife
|
|
|
|
|
True
Exploring the Unexplored.
|
|
|
|
|
how to add autocad tool box items to my wpf application?
|
|
|
|
|
|
Hi,
Imam using this to close the connection but I feel after many entries that the system will be slow and it will take a very long to run the process.. so is this enough:
if (sql_reader != null) sql_reader.Close();
if (sql_connection != null) { if (sql_connection.State == ConnectionState.Open) sql_connection.Close(); }
Technology News @ www.JassimRahma.com
|
|
|
|
|
That'll close the reader and the connection, but will not dispose of it - leaving that to the GC. Ideally, they'd be wrapped in a using-block.
Jassim Rahma wrote: I feel after many entries You're not opening/closing the connection in a loop, are you?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
You're not opening/closing the connection in a loop, are you?
what do you mean?
I tried this now and will observe it for sometime:
if (sql_reader != null) { sql_reader.Close(); sql_reader.Dispose(); }
if (sql_connection != null) { if (sql_connection.State == ConnectionState.Open) { sql_connection.Close(); sql_connection.Dispose(); } }
Technology News @ www.JassimRahma.com
|
|
|
|
|
Jassim Rahma wrote: what do you mean?
for (i = 1 to 5000)
{
IDatabase idb = new SqlDatabase();
idb.Open();
ICommand.ExecuteNonQuery;
idb.Close();
}
Jassim Rahma wrote: I tried this now and will observe it for sometime: Observe it? To see if it behaves?
Are you also disposing of the command?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Summing up what was indirectly referred to in the other response.
When you close a database resource, like a reader or connection you should also call Dispose. There are different ways to do that. You should do it EXPLICITLY in your code and you should not rely on garbage collection to do it for you.
When you close a data reader it can take time. That is implied in the documentation for close. If you don't want it to take that long then don't do as much with it before you close (and dispose) it.
Jassim Rahma wrote: I feel after many entries that the system will be slow a
Your belief is probably ill founded. Resource management, when done correctly, will seldom even be measurable much less significant in an application. What is likely to be far more significant is what you actually do with the database and how you do it. So for example it takes far more time to do a database query than it does to close/dispose of the connection you used to do the query.
|
|
|
|
|
Hello to all
I have an application in LAN on a page that contains a GridView I want to disable or prevent
The edition of a line when it is already in edit mode by another user
Thank you.
|
|
|
|
|
Why! This sound like you can't work out how to manage a multi user application rather than a valid technical question. Your requirement would mean locking the table on the server so no other user can add/edit/delete a record. A truly nasty requirement.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello,
When the user clicks the Edit button it takes a little time to validate the line
I do not want another user treats the same line.
Thank you.
|
|
|
|
|
Why not, why can't 2 or 10 or 100 users be editing/adding the data, it is common that last in is the winner. 2 people begin editing the line, first person to save the changes loses those changes when to 2nd person saves, unless you are doing column comparisons.
This is the normal way of building an applications. Only managers worry about the 2+ editor problem, the rest of us live in the real world and just build the app.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hello
I do not want a user to waste time processing a previously handled by another knowing that the treatment takes more than a minute online.
Thank you.
|
|
|
|
|
Now that is a different matter, if the source of the data is external to the system then you need an external process. If the data is selected by the user to process then put in place a selection process in your system. The user should "lock" the record when they select it for processing, then release it when completed.
I would use a dialog instead of a data grid. The user selects a record you flag it with a username and time and pop a dialog. When the dialog is closed you release the record.
You could also queue the records to a user, user 1 requests some records to process you deliver 1-5 for that user, user 2 requests some work so you deliver 6-10.
You need also need a repeating check for locked records older than a reasonable time span.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Locking, technet[^]
You can lock a single row[^] once someone starts editing.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Please I am a beginner in asp.net can give me an example.
Thank you.
|
|
|
|
|
You can't do this in ASP.NET. Well, not without a VERY COMPLEX solution.
Web servers cannot arbitrarily contact clients whenever they want. HTTP always relies on the client contacting the server for data and the server responding with the requested page. It NEVER goes the other way around.
You would have to use an out-of-band, TCP/IP-based client/server soltion, such as SignalR, to pull this off. But, you have a problem. What if one client "edits" a record, locking it for everyone else, and then that client either crashes or otherwise never submits any changes?? How are you going to detect this condition and unlock the record for other clients?? Not easily...
Really, this is WAY too much work to go through just to overly complicate your client pages for something that can be done with far better, and more reliable, concurrency control methods, such a SQL Timestamps. Google it.
|
|
|
|
|
I am using AjaxFileUploader to upload multiple files in my ASP.net project.
I want to validate RequiredFieldValidator on It, Means at least one file must be Upload before submit Form.
My Code is:
<ajaxtoolkit:ajaxfileupload
id="ajaxUpload1" throbberid="MyThrobber1" maximumnumberoffiles="5" runat="server" allowedfiletypes="jpg,png">
How can validate this control as Requiredfiled, because Simple RequiredFieldValidator does not work on it.
is there any other solution ???
|
|
|
|