|
Thank you very much, Sir.
I will try it again.
My code don't have
[Serializable]
and
protected MaoDataSet (SerializationInfo info, StreamingContext context) : base (info, context) {}
|
|
|
|
|
Dear, Sir.
I have another problem.
I have a class named MyTable derives from DataTable
I add it to MyDataSet.Tables[]
after Serialization and Deserialization
I get DataTable but cannot get MyTable
Thank again.
|
|
|
|
|
--------------------------------------------------------------------------------
Hi
I have a basic question. I want to copy a table in a db to another db (in the destination the table has to be created first with proper columns). the table name and schema will remain same. (I'm using sql server 2000).
Can you provide sample ado.net code, by which I can achieve that?
Thanks
|
|
|
|
|
This question belongs on the ADO/SQL board. Since I wrote the reply to it before stopping to consider that fact, I'll post it here, but in the future, try to keep the questions on-topic, please.
Assuming your tables are on the same server instance (otherwise you'll have to further qualify the table objects, link servers etc.):
INSERT INTO [new database name].[owner id].[new table name]<br />
SELECT * FROM [old database name].[owner id].[old table name]
Example:
INSERT INTO sampledatabase2.dbo.table1<br />
SELECT * FROM sampledatabase1.dbo.table1
This example uses the '*' wildcard for brevity. You really should list out the columns in your own code.
As for what code you might use, I would suggest using a SqlConnection and a SqlCommand (using the ExecuteNonQuery method of the SqlCommand to execute the above syntax).
As an alternative to creating the schema by hand, and assuming you have appropriate permissions, you could also do something like:
SELECT [old database name].[owner id].[old table name].*<br />
INTO [new database name].[owner id].[new table name]<br />
FROM [old database name].[owner id].[old table name]
Example:
SELECT sampledatabase2.dbo.table1.* <br />
INTO sampledatabase1.dbo.tablefoo<br />
FROM sampledatabase2.dbo.table1
but explicitly creating the schema, or using a script created from the original is safer.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
This method is fine only when source and destination tables are in the same server.
What if they are in different servers?
|
|
|
|
|
If you are doing a local replication task I would suggest using DTS or BCP.
Alex Korchemniy
|
|
|
|
|
I am trying to create an addin that will loop through all my projects in a
solution; then loop through all the forms with in a project to set a form property.
How can I test the project item to see if it is a form?
foreach (ProjectItem p in theProject.ProjectItems)
{
System.Diagnostics.Trace.WriteLine("ProjectItem = " + p.Name);
// Check to see if its a c# file Is there a better way
if (p.Name.Substring(p.Name.Length - 3, 3) == ".cs")
{
}
}
|
|
|
|
|
Well, I'm no expert in writing IDE extensions, because I've never written one. But, from 5 minutes worth of research on MSDN, I think you can use the Kind property of the ProjectItem object and see if it equals vsCMElementClass . From there, you'll have to drill into the ProjectItem and determine if the class inherits from System.Windows.Forms.Form. Since a file can contain more than just the Form class, you'll have to check all the classes in the file to find the correct class that represents the Form.
Do I have any example code? No, like I said, I've never written an IDE extension.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello,
I am using a richTextBox1 in a form, when I assign the text with richTextBox.Text or richTextBox.AppendText I am including a '\x0c' secuence that means page break but it is not doing that.
How can I insert a page break in a richTextBox?.
Txn.
|
|
|
|
|
Hmm. I can hardly imagine how a richTextBox could DISPLAY a page break, as its simply a text-scroller. I believe that you have to find a way yourself, like generate a new richTextBox beneath the first one, which would then hold the "next page". You have to include buttons to flip pages, though.
I believe the "\x0c" IS in the text, but simply not interpreted.
Cheers
Sid
|
|
|
|
|
Simply inserting "\x0c" will not do as it is recognized merely as a text which is the job of a RichTextBox (i.e., basically to display text). It will not "execute" commands unless you make it do so by writing some code.
If you notice, in MS Word, in the "Normal View", only a dotted line is shown for a page break (unlike the "Print Layout View"). It may be possible to write code in some imaginative way to draw the illusion of page break in a RichTextBox by creating a dotted line after a particular number of lines or length, etc. But, then you'll have to take care/control of the same on all occasions such as printing or scrolling, etc, and also to ensure that the same is not included in the actual text being searched or printed, etc.
Another option could be to create your own text editor (for some help on creating one by using say ArrayList of strings / lines and displaying them through code or trying something like what is known as linear model, see here[^]).
|
|
|
|
|
Thanks friedsfor your help,
perhaps I forgot to say it is not important for me what the RichTextBox display, what I really want is to see the text into a printPreviewDialog1 and is on this object where the line feed (page break) is not reflecting, that is when I want to Preview the document.
I don´t know if I need to do something with the document that I am using with the printPreviewDialog1.
this.printPreviewDialog1.Document = this.printDocument1;
Sorry if I was not explaining the correct functionality.
Tnx.
|
|
|
|
|
How can I code to make info in a treeview expanded, so that i dont have to click through all the nodes to get to the item i want? i have checked the help libraries and cant find anything.
Thanx!
|
|
|
|
|
Just select the root node of the treeview and call its Expand or ExpandAll method.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
For a particular TreeNode :
TreeView.Nodes[...].Expand()
(of course you can expand particular nodes a a paricular node as well)
For all nodes in a TreeView :
TreeView.ExpandAll()
//Kordzik
|
|
|
|
|
Oooops someone already posted that. Didn't refresh & didn't know
|
|
|
|
|
Hi.
I hava a little problem, in my code I have a System.Type object, I know that the class this system type object points to contains a static function called "string InputAPI()", but I don't know how to access it through the system type.
So how can I call a static function through a System.Type object?
All I know about the class that the System.Type points to is that it inherits from an abstract class called IMouse, which contains the "string InputAPI()" function.
|
|
|
|
|
You can use reflection to call a static member of a type.
For instance:
<code>
using System;
using System.Reflection;
public class ClassWithStaticMember
{
public static string GetMessage()
{
return "Here is a message from a static member.";
}
}
public class Client
{
public string CallStaticMemberByType(Type t)
{
// Make sure the type is valid
if (t == typeof(ClassWithStaticMember))
{
return (string)t.InvokeMember("GetMessage", BindingFlags.Public | BindingFlags.Static | BindingFlags.InvokeMethod, null, t, null);
}
else
{
return "The type was incompatible with the member required.";
}
}
}
</code>
Hope this helps.
<div style="COLOR: black; FONT-STYLE: italic; FONT-FAMILY: Arial; BACKGROUND-COLOR: lightsteelblue">The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’</div>
|
|
|
|
|
Thanks, it works.
I had tried that function, but I didn't know what to pass in the second last parameter, when passing null it didn't work .
|
|
|
|
|
Hello Gurus,
I would like to know if there is a .NET way (no Win32 API) to open special file names that are starting with the sequence "\\.\"? When I try to open the file with the System.IO.File.Open method, I get an exception:
<br />
An unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dll<br />
<br />
Additional information: FileStream will not open Win32 devices such as disk partitions and tape drives. Don't use "\\.\" in your path.<br />
so, how can I access to such a path without using the Win32 API?
Best regards.
There is no spoon.
|
|
|
|
|
You can't. What do you think the FileStream classes wrap?
If you want to use these kind of paths, you MUST use the Win32 API to do it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hey,
im trying to extract a jpg files width and height using C#.
up untill now i didnt find any thing usefull.
can someone help me out.
thanx...
|
|
|
|
|
Do you have the jpg loaded into an System.Drawing.Image object? If so, you should be able to use the Width and Height properties.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
I'm trying to connect a usb camera up, and take a picture and save it using C#. I can't find any example code. Can anyone point me in the right direction.
|
|
|
|
|
give up, not worth it
IM PROUD TO BE A GMAIL;
|
|
|
|