|
problem in using ,
i installed but i.e is not appearing on Visual Studio
NOTE:I am using Visual studio 2012,
i didnt find any where that Extension for 2012
|
|
|
|
|
Hi Dear Friends;
Want to ask a question about SqlDependency.
C # sql operation with SqlDependency in my side I want to see.
Example:
I got 2 MSSQL database,
are the first data in my database.
When you take action in the first database, Current Data I want to add my second database.
SqlDependency with the insert, update, delete, how do you find out the line?
I use the sample code I'm writing.
When you take action on this sql code can trigger windows form.
I'm asking transactions which took place in line?
I'm sorry for bad english.
#region Using directives
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Windows.Forms;
using System.Data.SqlClient;
#endregion
namespace NotifySample
{
partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
SqlConnection con;
SqlCommand cmd;
SqlDependency dep;
SqlDataAdapter da;
DataTable dt;
private void btnVeriCek_Click(object sender, EventArgs e)
{
con = new SqlConnection("data source=localhost;initial catalog=Dukkan;integrated security=SSPI");
con.Open();
cmd = new SqlCommand("Select DetayID,PersonelID,Ad,Soyad,Mail From dbo.PersonelDetay", con);
dep = new SqlDependency(cmd);
SqlDependency.Start("data source=localhost;initial catalog=Dukkan;integrated security=SSPI");
dep.OnChange+=new OnChangeEventHandler(dep_OnChange);
da = new SqlDataAdapter(cmd);
dt = new DataTable();
da.Fill(dt);
dgVeriler.DataSource = dt;
}
void dep_OnChange(object sender, SqlNotificationEventArgs e)
{
MessageBox.Show("THIS AREA SQL INSERT, UPDATE, DELETED WANT TO SEE DATA");
}
}
}
|
|
|
|
|
byerkan wrote: When you take action in the first database, Current Data I want to add my second database. Sounds like replication/synchronization to me.
byerkan wrote: SqlDependency with the insert, update, delete, how do you find out the line? You can't.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
save dynamically created chart in Extjs to perticular location , and after that getting image to specified loaction for exporting pdf document
Raju88
|
|
|
|
|
Is that a question or a statement? And given that Extjs is a Javascript product, what has this to do with C#?
Veni, vidi, abiit domum
|
|
|
|
|
Tic Tac Toe
code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Tic Tac Toe
{
public partial class Form1 : Form
{
private GameManager game_manager = new GameManager();
public Form1()
{
InitializeComponent();
}
private void Clicked(object sender, EventArgs e)
{
Button button = (Button)sender;
switch (button.Name)
{
case "button1":
game_manager.ButtonClicked(0, button, label1);
break;
case "button2":
game_manager.ButtonClicked(1, button, label1);
break;
case "button3":
game_manager.ButtonClicked(2, button, label1);
break;
case "button4":
game_manager.ButtonClicked(3, button, label1);
break;
case "button5":
game_manager.ButtonClicked(4, button, label1);
break;
case "button6":
game_manager.ButtonClicked(5, button, label1);
break;
case "button7":
game_manager.ButtonClicked(6, button, label1);
break;
case "button8":
game_manager.ButtonClicked(7, button, label1);
break;
case "button9":
game_manager.ButtonClicked(8, button, label1);
break;
}
}
private void label1_Click(object sender, EventArgs e)
{
label1.Text = "";
label2.Text = "";
}
private void resetButton_Click(object sender, EventArgs e)
{
button1.Text = "";
button2.Text = "";
button3.Text = "";
button4.Text = "";
button5.Text = "";
button6.Text = "";
button7.Text = "";
button8.Text = "";
button9.Text = "";
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
|
|
|
|
|
Write a better game manager that maintains state better that you are now??
|
|
|
|
|
just check in the switch statement that if the control already has some value then do nothing.
|
|
|
|
|
I didn't downvote, but just have to ask - you don't really want to encourage adding an if to each case. Not if there's an option to use GOTO .
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
oh sorry, i knew that it has to be re-written but if he wishes to continue with it he can add the code above. re-writting code recommended
|
|
|
|
|
Hi, I have a syntax question on extension method syntax.
Here is my most simple extension method code
using System;
using ConsoleApplication1;
namespace extensionTestNamespace.test.com
{
public static class ExtensionTest
{
public static String AAAAAAA<T>(this T x) where T : TestClass1
{
return "Extension Method Test";
}
}
}
and here is the code that uses it
using System;
using extensionTestNamespace.test.com;
namespace ConsoleApplication1
{
public class TestClass1 { }
public class TestClass2 { }
public class TestClass3 { }
class Program
{
private void run()
{
TestClass1 test1 = new TestClass1();
TestClass2 test2 = new TestClass2();
TestClass3 test3 = new TestClass3();
Console.WriteLine(test1.AAAAAAA());
Console.WriteLine(test2.AAAAAAA());
Console.WriteLine(test3.AAAAAAA());
}
static void Main(string[] args)
{
Program program = new Program();
program.run();
}
}
}
My question is the syntax to allow the extension method AAAAAAA to test1 and test2 but not to test3. I had wanted to write this code
public static String AAAAAAA<T>(this T x)
where T : TestClass1
where T : TestClass2
but it won't compile.
What I do not want to do is add a special extension method for each class type. What I do want is a single extension class but the where clause constraint has TestClass1 and TestClass2 but not TestClass3.
I don't know how to do it. Can it be done and if so I would appreciate help on the C# syntax.
Thank you
|
|
|
|
|
You can't do that. There's simply no way to express it. You could do it if TestClass1 and TestClass2 both extend some base class or implement some interface that TestClass3 does not, but you can't express a restriction "must be subtype of TypeA or of TypeB".
Here's what the standard[^] has to say about where:
We can supply an optional list of constraints for each type parameter. A constraint indicates a requirement
that a type shall fulfill in order to be accepted as a type argument. (For example, it might have to implement
a given interface or be derived from a given base class.) A constraint is declared using the word where,
followed by a type parameter and colon (: ), followed by a comma-separated list of constraints, which can
include a class type, interface types, other type parameters, the reference type constraint “class”, the value
type constraint “struct”, and the constructor constraint “new()”
The only thing that can do is express one or several constraints that must all be fulfilled.
|
|
|
|
|
As Harold says, you can't do that: you can declare an extension method that extends a single class (or interface) only, you can't "list" classes and expect it to work.
One way to do it, is to declare an empty interface and set the extension method to restrict to just those classes:
public interface IAllowThese { }
public static class ExtensionTest
{
public static String AAAAAAA<T>(this T x) where T : IAllowThese
{
return "Extension Method Test";
}
}
public class TestClass1 : IAllowThese { }
public class TestClass2 : IAllowThese { }
public class TestClass3 { }
You can then do this:
TestClass1 test1 = new TestClass1();
TestClass2 test2 = new TestClass2();
TestClass3 test3 = new TestClass3();
Console.WriteLine(test1.AAAAAAA());
Console.WriteLine(test2.AAAAAAA());
Console.WriteLine(test3.AAAAAAA());
And only the final one will give a compilation error.
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
That I get all puffed up like a fugu-fish in mating display, awarding myself a succulent lagniappe of self-esteem-bloat: thinking I was clever to be first out the gate; and, lo, the bird of time was on the wing thirty-four minutes before me, yet my sluggard browser revealed not the shadows of your wings.
And, now, alack, alas, I whimper: back in the sewer again; hearing the madding crowd snicker as they say: "look: a me-too."
I can't understand this long delay in forum messages being posted when other parts of CP seem to be updated instantly.
“But I don't want to go among mad people,” Alice remarked.
“Oh, you can't help that,” said the Cat: “we're all mad here. I'm mad. You're mad.”
“How do you know I'm mad?” said Alice.
“You must be," said the Cat, or you wouldn't have come here.” Lewis Carroll
|
|
|
|
|
Don't fret about it: it happened to you this time, It'll happen to me next time!
It's good to know we were thinking on the same wavelength: that validates the whole idea in a way.
I think all the hamsters are in transit to Puppy Bowl[^] which does slow the site down.
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
One solution would be to make Classes you want to use your extension inherit from a common Interface; Classes that don't inherit from that Interface will then throw a compile-time exception if you try and use the extension with them. Consider:
public interface UseAAAAAAA {}
public static class ExtensionTest
{
public static String AAAAAAA<T>(this T x) where T : UseAAAAAAA
{
return "Extension Method Test Class: " + typeof(T).Name;
}
}
public class Test1 : UseAAAAAAA {}
public class Test2 : UseAAAAAAA {}
public class Test3 {} Test:
Test1 test1 = new Test1();
Test2 test2 = new Test2();
Test3 test3 = new Test3();
Console.WriteLine(test1.AAAAAAA());
Console.WriteLine(test2.AAAAAAA());
“But I don't want to go among mad people,” Alice remarked.
“Oh, you can't help that,” said the Cat: “we're all mad here. I'm mad. You're mad.”
“How do you know I'm mad?” said Alice.
“You must be," said the Cat, or you wouldn't have come here.” Lewis Carroll
|
|
|
|
|
BillWoodruff wrote: inherit from a common Interface
A minor correction: you implement an interface, you don't inherit from it.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi Richard, I fall-on-my-face in abject shame, righteously corrected, good Sir ! You gotta admit, though, that using an empty Interface in this way is kind of ... kinky.
“But I don't want to go among mad people,” Alice remarked.
“Oh, you can't help that,” said the Cat: “we're all mad here. I'm mad. You're mad.”
“How do you know I'm mad?” said Alice.
“You must be," said the Cat, or you wouldn't have come here.” Lewis Carroll
|
|
|
|
|
The trick is not to be "writing" mulitple extension methods but to utilize operator overloading which still shares all of the common code.
private static void HelpFooBar<T>(T t) where T :baseclass
public static void FooBar(this RealObject o){
HelpFooBar(o);
}
public static void FooBar(this AnotehrObject o){
HelpFooBar(o);
}
Also, as previously mentioned. Class inheritance is the best way.
Even further if you "own" the classes just create a common interface.
|
|
|
|
|
hello
Console Application c# & use shape & color
|
|
|
|
|
If you really want to use shapes and colours, then a Console application is not the best solution: it is possible to draw shapes and so forth with a console app, but it's generally a lot more trouble than it's worth, since the console does not support and graphics methods directly and ASCII art is a PITA! Seriously, I'd look at a WinForms application as a minimum for anything more complex that basic text input / output (and even then, I'd probably want almost zero input with that.
Colours you can do: http://www.dotnetperls.com/console-color[^]
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
Your question is nota question. We really have no context information at all and no description of what you're really trying to do.
The other answer you got is about the best you can hope for given the complete lack of detail in your question. Keep this in mind when you ask questions in the future.
|
|
|
|
|
I am sorry brother, dint understand your question. It looked more like a puzzle.
|
|
|
|
|
Given the lack of clarity in your question, the closest answer I can give you is this - a console output to draw a rectangle in a different colour using standard text characters.
public void PrintRectangle()
{
Console.BackgroundColor = ConsoleColor.Green;
Console.ForegroundColor = ConsoleColor.DarkGreen;
Console.WriteLine("+----+");
Console.WriteLine("| |");
Console.WriteLine("| |");
Console.WriteLine("| |");
Console.WriteLine("| |");
Console.WriteLine("+----+");
Console.ResetColor();
}
|
|
|
|
|
I'm new to C#,am using form application, how i can store image into database and retrieve the image from database .
|
|
|
|
|