|
Does anybody know what the equivalent C# code is for this C++ code :-
this->label1->Text = Convert::ToString( nums[1] );
|
|
|
|
|
this.label1.Text = nums[1].ToString();
modified on Monday, July 19, 2010 12:23 AM
|
|
|
|
|
To get identical behavior you should also use the Convert.String method in the converted code since that's just a framework call and not syntax:
<pre>this.label1.Text = Convert.ToString( nums[1] );</pre>
David Anton
Convert between VB, C#, C++, & Java
www.tangiblesoftwaresolutions.com
|
|
|
|
|
I want to draw polyline and smooth it. I use a WPF technology. How can I solve this problem. We hope to receive assistance.
|
|
|
|
|
This is actially not the best forum to get WPF related answers.
Next time, use the WPF forum.
To draw polygons in WPF, see here[^].
|
|
|
|
|
Thanks for your help. But maybe that's not what I need. I want to draw a Polyline when the mouse moves over a canvas. Add Point when the mouse is moved, the connecting point with the Linesegment together, and add the LineSegment to Pathgeometry. Then use Drawingcontex.DrawGeometry to draw. But polyline obtained not smooth as expected and when the mouse is moved quickly add points to the Polyline very far apart. I can not solve this problem. Hope to get help. Thanks a lot
|
|
|
|
|
I have a created a database by the name of ABC. I want to copy the employees table from the northwind database to my database. Whats the best way to do it.
Can someone direct me to a useful link or let me know how to do it dynamically.
|
|
|
|
|
Use SQL Server Management Studio SSMS.
SQL 2008 (earlier are similar)
Click on the database (ABC)
select tasks
select import data
follow the wizard
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
That does not sound very C#-ish
|
|
|
|
|
I am trying something like this, but its not very accurate
SqlDataAdapter da;
DataSet ds = new DataSet();
string conString = @"server = .\sqlexpress;
integrated security = true;
database = northwind";
da = new SqlDataAdapter("select * from employees", conString);
da.Fill(ds);
DataTable table = ds.Tables[0];
string conString2 = @"server = .\sqlexpress;
integrated security = true;
database = ABZ";
string commandString = "Create table Employees ( ";
SqlConnection con = new SqlConnection(conString2);
DataTable tab = new DataTable("Employees");
foreach (DataColumn column in table.Columns )
{
commandString = commandString + column.ColumnName + " " + column.DataType + " " + "nvarchar (50), " ;
}
I can make a switch statement for the data type. But the maximum size of the data always shows up as -1
|
|
|
|
|
If they're on the same server you can use a SELECT statement to create a new table with the contents you want.
|
|
|
|
|
|
Thanks in advance, as that was the second part of my problem, to copy the data once the table has been copied. The first one was to copy the table itself, still looking for an answer.
|
|
|
|
|
So you didn't look into using a SELECT to create and populate the table?
|
|
|
|
|
I was trying something like this
SqlDataAdapter da;
DataSet ds = new DataSet();
string conString = @"server = .\sqlexpress;
integrated security = true;
database = northwind";
da = new SqlDataAdapter("select * from employees", conString);
da.Fill(ds);
DataTable table = ds.Tables[0];
string conString2 = @"server = .\sqlexpress;
integrated security = true;
database = ABZ";
string commandString = "Create table Employees ( ";
SqlConnection con = new SqlConnection(conString2);
DataTable tab = new DataTable("Employees");
foreach (DataColumn column in table.Columns )
{
commandString = commandString + column.ColumnName +" nvarchar (50), " ;
}
commandString = commandString + ")";
SqlCommand cmd = new SqlCommand(commandString, con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
MessageBox.Show("Table Created");
But the prob was I was getting a -1 value for column.MaxLength when I was trying this
foreach (DataColumn column in table.Columns )
{
commandString = commandString + column.ColumnName +" nvarchar (" + column.MaxLength + "), " ;
}
But how do you suggest I use the Select statement?
|
|
|
|
|
A statement like SELECT * INTO JunkCopy FROM Junk.dbo.JunkName will copy a table and it contents.
To add rows thereafter, a statement like INSERT INTO JunkCopy SELECT * FROM Junk.dbo.JunkName , but probably with a WHERE CLAUSE to avoid duplicates, should do the trick.
But these will only work when the databases are on the same server or in linked servers.
I have also had to copy tables among different database systems with code similar to (but infinitely better than ) the code you posted.
|
|
|
|
|
Thanks a lot that did the trick. That was what I was looking for.
Select * into
|
|
|
|
|
|
Hi,
I am trying to validate a xml document against xsd in c#. I used the code
XmlReaderSettings settings = new XmlReaderSettings();
settings.ValidationType = ValidationType.Schema;
And i get the following error.
TesterSchemaValidator.settings' is a 'field' but is used like a 'type'
Please help me, why i am getting this error.
|
|
|
|
|
You're setting the ValidationType in the class level (outside a method).
Eslam Afifi
|
|
|
|
|
Thank you so much
|
|
|
|
|
HELLO ,
I try to search string in document (word,pdf,xls,ppt,txt) and i could not.
I search in the web and nothing work's.
HELP HELP.....
THANKYOU.
|
|
|
|
|
|
A common way to do this is to use the index API which requires you to use the IFilter[^] interface.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
I am making a game in XNA and I have a component that accepts some parameters (rows,columns and tile size) and renders a two-dimensional grid where I like (its visual).
As I have started to plan my software I know that some of the Grid settings such as "Tile Width/Height" may need to be read from other objects later on such as a Windows form that can change the grid settings...
I have read that a "interface between components" is good practice so would any one advise me to create a class that allows another class to receive data from the grid?
Such functionality :
GetTileWidth,GetTileHeight,GetRows .....
So for example:
GridEditorForm ---->gets the tile height from ---> GridDetails --> gets tile height from ---> Grid
instead of:
GridEditorForm ---> gets the tile height from ---> Grid
?
Another idea I had was to have some kind of "Struct" that stores the grid data that may be read from other objects and make an interface to pass about its information?
Such as:
struct GridDetails:
tilewidth,tile height,rows
....
Thanks
|
|
|
|