|
as first, delegate should be public, not private.
Then , Control is a generic type, but only your specific controls has this delegate. Then, you should make a cast.
var specificControl= ViewingWindow as YourType;
if(specificControl!=null && speciicControl.NewFrameDelegate!=null )
speciicControl.NewFrameDelegate.
Just an extra note: parameter names never should start with maiusc: maiusc is used for properties and methods
|
|
|
|
|
i am using this command in sql server it is executed....
/** update product set quantity= quantity - 10 where productname='sugar' ****/
but how to use same command in windows form app...
please give me any idea about this..
|
|
|
|
|
Use a SqlCommand for the actual sql text, and use a SqlConnection for the connection to the database. A simple search will reveal millions of hits on these topics. You need to use the ExecuteNonQuery method for your command.
|
|
|
|
|
+5
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
|
Pete O'Hanlon wrote: Univote countered.
Once again.
|
|
|
|
|
You can downvote Pete's answer, but that doesn't make it less correct. It's a very basic piece of work, and there's an copy/paste example in the documentation.
If that's too complex, then start studying.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
|
|
|
|
|
Dear,
May be you need something like below code..
protected void UpdateData()
{
int intQuantity = 0;
SqlConnection con = new SqlConnection("Your Connectionstring here");
SqlCommand cmd = new SqlCommand("update product set quantity=@Quantity where productname=@Product", con); ;
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@Quantity", intQuantity - 10);
cmd.Parameters.AddWithValue("@Product", "Sugar");
cmd.ExecuteNonQuery();
}
KiranKumar Roy
|
|
|
|
|
I am working on a core project a class library.
and it is acting as a DAL for client
now DAL is going to fetch records from database
i heard about memorycache
but once i created a cache i want it to update itlself if a new record is added in table
is there a way my cache is recreated if record is entered in table?
|
|
|
|
|
It depends what your application is (BTW - this question is more suited for the design forum as it's more to do with your application architecture is). If this is for a website, then simply have the inserts trigger an update to the cache - you control the code, so it's easy for you to invalidate the cache. If it's a desktop application, and you are using SQL Server, I would recommend using a Sql Dependency.
|
|
|
|
|
Thanks i also looked at sqldependency but i cant use that, since this project is a core project [dll] database can be any, sql, oracle, db2 etc.. so is there any suggestion what should i use to increase performance.
Also is caching good? As the amount of data increases caching can cause problems in the future rather then optimizing it.
I know this is a design question but there is no design forum here so i asked here.
|
|
|
|
|
|
nitin_ion wrote: Also is caching good?
You can't say definitively whether caching is good or not. It really depends on what you are using it for. If you just dumped all of the records in a large table in it and then had to post process it after you retrieved it from the cache just to find a couple of records, then you shouldn't use the cache. If you are using it to hold static lookup data then it's a fine choice.
As I said in my first answer, as you control updates/inserts and deletes in your DAL, I would use that to decide whether or not the cache needs to be refreshed. Just spitballing here, but one way to do this would be to have a CacheManager class in which you listed all the tables that have been cached (this data is a perfect candidate for storing in a database and holding in a cache) - then to each of your inserts, etc, simply call a TriggerRefresh method on the CacheManager. Simplistically, all it would need to do is empty that particular cached entry and then let your application lazy load the data on the next hit.
|
|
|
|
|
Thanks, good explanation. I will keep these points in mind.
Since I am working in .Net I need caching to be independent of database. Currently .Net provides SqlDependency for MS SQL only but i need it for any Database. Do you have any idea how can i implement it ir-respective of any type of database or is it that we need to check or support caching for some database.
|
|
|
|
|
Caching isn't implemented using SqlDependency and isn't database dependent. If you are writing ASP.NET, you have an in built cache to work with. If you are writing desktop apps, implementing your own caching is trivial.
I have already outlined what you need to do to implement cache refresh code. I can't see how many different ways I can say the same thing.
|
|
|
|
|
How can i generate xml file with table schema and value like this:
<xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
="" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
<s:schema id="RowsetSchema">
<s:elementtype name="row" content="eltOnly" rs:commandtimeout="30">
<s:attributetype name="VchrNo" rs:number="1" rs:writeunknown="true">
<s:datatype dt:type="string" rs:dbtype="str" dt:maxlength="20" rs:maybenull="false">
<s:extends type="rs:rowbase">
<rs:data>
<z:row vchrno="JVSH0001">
|
|
|
|
|
It seems you want to XSD from your table. If that's your question, this[^] might help
-Sarath.
Rate the answers and close your posts if it's answered
|
|
|
|
|
Riddle:
There are eight cards divided into 4 red and to 4 black.
You have to order them correctly, so that when the first card draw (no matter what color) next card must be different from the previous. Means to get a sequence of different colors.
For example:
Array A: Contains the colors: [b, b, b, A, A, b, A, A] (right to left).
When the first card pull the other card go to the end of the fund. Then pull the other card and it should be a different card from before.
That is supposed to go after the first card retrieval array like this: [a, b, b, b, a, a, b]
After another array retrieval is such that [a, a, b, b, b, a]
More retrieval [b, A, A, b, b]
More retrieval [b, b, A, A]
More Extract [a, b, b]
More retrieval [b, A]
More retrieval [b]
More retrieval and cash cards is all over and I got a set of cards (from left to right): [b, a, b, a, b, a, b, a]
1. Written operation in C # which accepts an array, the operation returns true if the array can solve the riddle another lie.
2. Written a program that runs the operation and returns the correct number sequence.
3., And also if you can to build a computational model of the program (that I just started learn computational models) so it will make it easier for members of the forum to better understand the program.
Thank
|
|
|
|
|
michae110 wrote: You have to order them correctly, That means you.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
I've read this three times and still can't find a question in that post.
|
|
|
|
|
This is homework.
Try something first and then post your queries with code snippets - someone might be able to help you.
|
|
|
|
|
This is highly suspicious of homework. If it is, contact your professor about the problem, and do not expect people here to do it for you.
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
First off, let me apologise if this seems a really basic question, but I've been searching for some answers/guidance for weeks.
I have a windows form with a Datagridview (DGV) bound via a bindingsource to a data table which is filled from a simple "Select * from table".
I also have an "Update" button.
I want the user to make changes to existing data in the grid and potentially add a new row using the blank row at the end of the DGV. When the user clicks the "Update" button I want to loop through the rows in the DGV(or underlying whatever) and, if a row has been changed or added, I want to call a stored procedure with column data parameters and an "action" parameter ("I" for insert, "U" for update, etc.)
On the "update" click, I have the code behind shown below.
However, when I click on the Update" button I get a runtime error indicating that "DataRow row in (dgvDocumentName.DataSource as DataTable" is null. I'm guessing that this is the wrong casting. If so, what should be the casting to allow me to iterate over the rows. If not, then what else am I doing wrong? Any help please would be fantastic. Thanks, James
private void btnUpdate_Click(object sender, EventArgs e)
{
dgvDocumentName.EndEdit();
foreach (DataRow row in (dgvDocumentName.DataSource as DataTable).Rows)
{
if (row.RowState != DataRowState.Unchanged)
{
String sAction;
switch (row.RowState)
{
case DataRowState.Added:
sAction = "I";
break;
case DataRowState.Deleted:
sAction = "D";
break;
case DataRowState.Modified:
sAction = "U";
break;
default:
sAction = "U";
break;
}
documentsTableAdapter.procActionDocuments(Convert.ToInt32(row["colDocumentID"]),
row["colDocumentName"].ToString(),
Convert.ToInt32(row["colDocumentType"]),
row["colDocumentText"].ToString(),
sAction);
}
}
}
|
|
|
|
|
In a C# 2008 console application, I want to select files from a specific folder location and then select certain excel spreadsheets from that location. I want to pick files where the first part of the name can be anything but the last part of the name is summ.xlsx.
I know I can pick the directory path with a statement that looks like the followinng:
If (Directory.Exists(strFullpath))
I know that if I want to ask if a file exists by the full name, I would say:
if (File.Exists("CompanyName_summ.xlsx")
However in this case I want to pick files where the last part of the name ends with
summ.xlsx. Note: Due to the fact there are several kinds of *.xlsx files that will reside in the specific directory, I can not pick the files by the *.xlsx file extension alone.
Thus can you tell me how I would write the code to ask if "_summ.xlsx" exist in the selected directory? Also if the files exist, I would also like code and/or be pointed to a reference that will show me how to access the excel spreadhseet(s).
|
|
|
|
|
Try
DirectoryInfo di = new DirectoryInfo(dir);
FileInfo[] sumfiles = di.GetFiles("*sum.xslx");
if (sumfiles .Length > 0)
{
}
|
|
|
|