|
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)
{
}
|
|
|
|
|
This is all basic stuff. Have you considered buying a book on C#? You might find your work progresses faster. Jon Skeet's book is widely considered a good choice.
|
|
|
|
|
In a C# 2008 /2010 application, I need to write code to acomplish the following tasks:
1. Will search a file directory path to locate a specified folder. The specfic folder name will look like: Company name1(trannumber). Basically the folder structure name is the company name, with paraenthesis with a transction number.
2. Within the selected folder, I need to pick the excel files where the names look like the following:
company1summ.xlsx,
company2summ.xlsx.
Basically I need to pick the summ.xlsx part of the file name. I do not want the company name. I do not want to pick the *.xlsx only since there will be other .xlsx files in the directory that I do not need to work with.
Thus can you tell me how to accomplish my goal and/or point me to a reference I can use to help me accomplish this task?
|
|
|
|
|
|
Hi,
I have gridPatients_DoubleClick in my application which has a code inside it.
I want to use the same code in gridPatients_KeyDown
using C#, How can I call the gridPatients_DoubleClick from gridPatients_KeyDown?
|
|
|
|
|
Try the following approach - anything else is unclean:
private void gridPatients_DoubleClick(object sender, System.EventArgs e)
{
DoStuff();
}
private void gridPatients_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
DoStuff();
}
private void DoStuff()
{
}
|
|
|
|
|
Quite right. Although the key down handler should be
private void gridPatients_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if(the key was the one you wanted)
DoStuff();
}
|
|
|
|
|
In a C# 2008 application, I have the following linq to sql statement setup so far.
eDataContext eData = new eDataContext();
var eSelect = (from iw in eData.Ibooks
join ip in etData.IPack on iw.P_ID equals ip.P_ID
join eTrack in eData.eRPT_Trans
on ip.TNum equals eTrack.P_ID
where ip.TNum == packageId
select iw).FirstOrDefault();
I want to obtain values from the 3 different tables listed in the statement above
How do I change the linq statement above so that I can obtain data from all three tables?
Thus can you show me how to obtain data from all 3 tables?
|
|
|
|
|
As part of your select statement, you can put any fields from the three tables in there, just as if you were doing a select in SQL. Ex: Select {iw, ip, eTrack}. The best thing would be to use select fields instead of all of the fields from all three tables.
|
|
|
|
|
eDataContext eData = new eDataContext();
var eSelect = (from iw in eData.Ibooks
join ip in etData.IPack on iw.P_ID equals ip.P_ID
join eTrack in eData.eRPT_Trans
on ip.TNum equals eTrack.P_ID
where ip.TNum == packageId
select new
{
iw.P_ID,
ip.P_ID,
eTrack.P_ID
/*
Other fields
*/
}
).FirstOrDefault();
|
|
|
|
|
Hi all,
In my windows form I have many group-boxes with text-boxes.
I am changing the back color of the text-boxes whenever a text-box has or looses focus.
This works OK.
I also want to add a help button in the group-box when a text-box in this group-box has focus,
but my help button is added three times?
This is the code I use:
private void control_Settings()
{
Button buttonHelp = new Button();
buttonHelp.BackColor = System.Drawing.Color.Transparent;
buttonHelp.Image = Properties.Resources.HelpButtonImage;
buttonHelp.Dock = DockStyle.Right;
buttonHelp.Name = "buttonHelp";
buttonHelp.Size = new System.Drawing.Size(25, 25);
buttonHelp.UseVisualStyleBackColor = false;
buttonHelp.Click += new System.EventHandler(this.buttonHelp_Click);
foreach (Control gb in Controls)
{
if (gb is GroupBox)
{
GroupBox grpbx = (GroupBox)gb;
foreach (Control t in grpbx.Controls)
{
TextBox textBox = t as TextBox;
if (textBox != null)
{
textBox.Enter += delegate(object sender, EventArgs eventArgs)
{
((TextBox)sender).BackColor = Color.Gold;
Control pToAd = ((TextBox)sender).Parent;
if(!pToAd.Controls.Contains(buttonHelp))pToAd.Controls.Add(buttonHelp);
};
textBox.Leave += delegate(object sender, EventArgs eventArgs)
{
Control pToRemove = ((TextBox)sender).Parent;
((TextBox)sender).BackColor = Color.White;
pToRemove.Controls.Remove(buttonHelp);
};
}
}
}
}
}
Thanks in advance,
Groover
0200 A9 23
0202 8D 01 80
0205 00
|
|
|
|
|
You must have something strange going on, I just copied your code into a blank winforms project and it worked perfectly.
(I changed some of the naming so I could understand the flow better)
using System;
using System.Drawing;
using System.Windows.Forms;
public partial class FormMain : Form
{
public Form1()
{
InitializeComponent();
ControlSettings();
}
private void ControlSettings()
{
Button buttonHelp = new Button();
buttonHelp.BackColor = System.Drawing.Color.Transparent;
buttonHelp.Dock = DockStyle.Right;
buttonHelp.Name = "buttonHelp";
buttonHelp.Size = new System.Drawing.Size(25, 25);
buttonHelp.UseVisualStyleBackColor = false;
foreach (Control control in Controls)
{
if (control is GroupBox)
{
GroupBox groupBox = (GroupBox)control;
foreach (Control nestedControl in groupBox.Controls)
{
TextBox textBox = nestedControl as TextBox;
if (textBox != null)
{
textBox.Enter += delegate(object sender, EventArgs eventArgs)
{
((TextBox)sender).BackColor = Color.Gold;
Control parent = ((TextBox)sender).Parent;
parent.Controls.Add(buttonHelp);
};
textBox.Leave += delegate(object sender, EventArgs eventArgs)
{
Control parent = ((TextBox)sender).Parent;
((TextBox)sender).BackColor = Color.White;
parent.Controls.Remove(buttonHelp);
};
}
}
}
}
}
}
|
|
|
|
|
Thank You Dave for Your effort,
Knowing there is nothing wrong with my code, I found there is something strange.
ControlSettings()
was also called in:
private void Form1_Resize(object sender, System.EventArgs e)
{
control_Settings();
this.Invalidate();
}
to do some other settings.
If I remove these other settings it is still not working,
If I remove the form resizing it is working OK??
I do not do any resizing so why is the form resize event breaking my control_Settings??
0200 A9 23
0202 8D 01 80
0205 00
|
|
|
|
|
Then remove either control_Settings(); from the resize handler, or stop handling the event if you don't need it.
I added the call only to the constructor as this is the type of code that would normally only be run once.
|
|
|
|
|
I agree with Dave that the code presented works for placing and removing a button. Of course as soon as you try to click on it, the textbox loses focus and the button disappears!
Alan.
|
|
|
|
|