If you're using a strongly-typed DataSet, it's possible that you might have the DataColumn.AllowDBNull and / or the DataColumn.Unique properties set to false and true, respectively. These conditions might be validated before any events are fired on the underlying rows.
With the MSDE/SQL Server, you'd simply enter (newid()) as the default value for the field in the table on the server and that's it.
Heath Stewart wrote: With the MSDE/SQL Server, you'd simply enter (newid()) as the default value for the field in the table on the server and that's it.
Yes that could be done in ACCESS too.
Heath Stewart wrote: If you're using a strongly-typed DataSet, it's possible that you might have the DataColumn.AllowDBNull and / or the DataColumn.
Hehhee...you know what error I get now after set AllowDBNull to true?
Error when committing the row to the original data store.
Cannot change a proposed value in the RowChanging event. Do you want to correct the value?
The whole point of using guid is be aware of Primarykey in the application rather than that AotoNomber. I don't wanna miss it.
This happens more often with Debug builds than Release builds, but I often have a Form with lots of controls and, hence, lots of painting to do that launches another Form, whether it is an Open File Dialog or a new Form. Basically, the Form at the bottom of the z-order does some ugly flashing while the OpenFileDialog or new Form closes.
I've tried SuspendLayout/ResumeLayout on the Form at the bottom but this doesn't seem to help with its constituent controls. Any ideas on how to stop this?
I can show you screenshots if you think that would help.
SuspendLayout and ResumeLayout are really only useful when initializing controls. Once they're initialized, it's pointless to use them.
As for the problem, do you notice the flickering when passing another window over your application (a window from another application)? If so, painting isn't the error exactly. Whatever occurs in your app in this case when you close the form is eating up enough CPU cycles - or blocking the main UI thread completely - to cause slow repainting of invalidated regions.
If the behavior is the same whether you pass one of your windows, or a window from another application over yours (or minimize -> restore, whatever to invalidate your form), then you might have to consider overriding several of the more offensive controls and enable double-buffered painting. See the Control.SetStyle method and ControlStyles enumeration documentation for details.
If many of these controls are already custom controls that you've written, using a double-buffered approach to painting (if you haven't already) will help, but you should also be mindful of the invalidated region when handling OnPaint (its better to override OnEventName methods when possible, as opposed to handling the events in a child class) and only repaint the invalidated regions (again, if you haven't already).
I wanna check in my database if an item exist,what do you suggest is the best way for that?I myself get a quey whith WHERE condition contain that value ,if it return null so it doesn't exist. I use MS Access so I can't use stored procedure.
I want a way other than Unique property.
Do you mean you want to check to see if a column, table, view, etc. exists in your database? If so, you can do this easily in SQL Server / MSDE (which is a hell of a lot better than MS Access, and MSDE is free (it is SQL Server without some of the advanced features and limited connections)) using the SCHEMA_INFORMATION tables.
For MS Access, it doesn't provide such meta-data that I'm aware of (I did a lot of programming with access many years ago, but haven't in the last couple years...thank God!). You can use a Module and use the object model to see if objects exists, but I'm not sure how you could execute such a function without using an interop assembly for MS Acccess.
You really should take a look at MSDE, though. It's a royalty-free, relatively small installation (you can even have up to 16 instances of MSDE/SQL Server running on a single machine) with REAL security (both SQL and Windows authentication modes) and is a true RDBMs.
Sorry I couldn't answer your question the way you wanted, but 1) I don't think it's possible (from what I remember, and from what the MS Access documentation says - or rather doesn't say), and 2) MS Access sucks for any serious programs. You can also take advantage of the System.Data.SqlClient namespace elements with MSDE, too - which gives you much better support that generic OLE DB (which is an abstract data access mechanism, after all).
Thanks for reply but I don't want to look about a column. I kmow those things about SCHEMA_INFORMATION and other things you say,I want to chheck existence of a record in table. I have two column:First Name and LastName. I want to check if First Name+LastName is unique. I do it in the way that I mentioned in first message but I want to know if there is better way or not.
Sorry, your question didn't quite make sense. "Record" instead of "item" would've been the optimal word. I didn't quite follow what you meant.
The way you're doing it (or using the COUNT aggregate and checking for a result value of 1) is fine, but you can create a multi-field index that is unique, thus making a UNIQUE index as you could in MSDE/SQL Server. I know you said you didn't want to do this, but I don't know if you were aware that multi-field indexes are possible.
Just open the Indexes Window for your table. On a new line, type an index name (like "Name"), and select the first field you want. Below that, select the second field you want but do not type an index name. You can do this for up to 10 rows. Finally, go back to the first row and set Unique to Yes. This is documented in the MS Access help. This should also cause an OleDbException to be thrown, which you can catch in a try-catch block and handle gracefully. We do this with SQL Server on our web site quite a bit and just show friendly errors when they occur while logging more information to the trace log (or other event target).
First of all, it is not the Windows Forms part of the .NET framework that deals with XML. The XML classes are found in System.Xml namespace (although access to Xml files can also be made through the System.Data classes if they are database-like.
Did you try searching CodeProject? I found the following articles that explain different ways of dealing with XML files:
Exec is an internal method within the visual studio ide.
For generic tasks, you should try the 'Process' object.
You can find it in the 'System.Diagnostics' namespace.
is there any way to gain the expand collapse feature using c#.I mean something similar to the one we are seeing here.the thread expand/collapse feature..looking forward for the replies and thx in advance.
You should try searching the forums using "Search Comments" above (search this, the lounge, and anything else that seems relevent). There is code out there and this has been answered before. Google will also reveal some results.
privatevoid pd_PrintPage(object sender, PrintPageEventArgs e)
// I don't rem
new PaperSize("Custom", 11.69 * 100, 16.54 * 100);
You should also take a look at the PrinterSetttings.PaperSizes documentation. This is a collection that contains each PaperSize that the printer supports. You can enumerate and determine if the printer supports A3 and then get that PaperSize:
foreach (PaperSize size in PrinterSettings.PaperSizes)
if (size.Kind == PaperKind)
returnnull; // or throw an Exception that A3 is not supported